Created Report Embed
This commit is contained in:
23
main.py
23
main.py
@@ -594,8 +594,27 @@ async def message_voting(ctx):
|
|||||||
conn.commit()
|
conn.commit()
|
||||||
await ctx.respond(f"Done.", ephemeral=True)
|
await ctx.respond(f"Done.", ephemeral=True)
|
||||||
|
|
||||||
# HIER
|
async def create_report_embed():
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Aktuelle Stimmen",
|
||||||
|
color=discord.Colour.blurple(), # Pycord provides a class with default colors you can choose from
|
||||||
|
)
|
||||||
|
cur.execute("SELECT recruits.nickname, count(yes_votes.id), count(no_votes.id), recruits.discord_id FROM recruits LEFT JOIN no_votes ON recruits.discord_id = no_votes.discord_id_recruit LEFT JOIN yes_votes ON recruits.discord_id = yes_votes.discord_id_recruit WHERE recruits.recruit = 1 GROUP BY recruits.nickname")
|
||||||
|
recruits = cur.fetchall()
|
||||||
|
description = ""
|
||||||
|
cur.execute("SELECT value FROM settings WHERE name = ?", ("guild", ))
|
||||||
|
guild_id = cur.fetchone()
|
||||||
|
guild = bot.get_guild(guild_id)
|
||||||
|
for recruit in recruits:
|
||||||
|
if recruit[2] != 0:
|
||||||
|
cur.execute("SELECT reason, discord_id_voter FROM no_votes WHERE discord_id_recruit = ?", (recruits[3]))
|
||||||
|
no_votes = cur.fetchone()
|
||||||
|
description = description + "**" + recruit[0] + ":**" + recruit[1] + "Ja, " + recruit[2] + "Nein.\n"
|
||||||
|
for no_vote in no_votes:
|
||||||
|
description = description + "Begründung von " + guild.get_member(no_vote[1]).display_name + ": " + no_vote[0] + "\n\n"
|
||||||
|
else:
|
||||||
|
description = description + "**" + recruit[0] + ":**" + recruit[1] + "Ja, " + recruit[2] + "Nein.\n"
|
||||||
|
return embed
|
||||||
|
|
||||||
@settings.command(description="Sendet den Report in den aktuellen Kanal.")
|
@settings.command(description="Sendet den Report in den aktuellen Kanal.")
|
||||||
@default_permissions(manage_roles=True)
|
@default_permissions(manage_roles=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user