Fixed Report Embed
This commit is contained in:
12
main.py
12
main.py
@@ -837,22 +837,26 @@ def create_report_embed():
|
|||||||
title="Aktuelle Stimmen",
|
title="Aktuelle Stimmen",
|
||||||
color=discord.Colour.blurple(), # Pycord provides a class with default colors you can choose from
|
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")
|
cur.execute("SELECT recruits.nickname, recruits.discord_id FROM recruits WHERE recruits.recruit = 1")
|
||||||
recruits = cur.fetchall()
|
recruits = cur.fetchall()
|
||||||
description = ""
|
description = ""
|
||||||
cur.execute("SELECT value FROM settings WHERE name = ?", ("guild", ))
|
cur.execute("SELECT value FROM settings WHERE name = ?", ("guild", ))
|
||||||
guild_id = cur.fetchone()[0]
|
guild_id = cur.fetchone()[0]
|
||||||
guild = bot.get_guild(guild_id)
|
guild = bot.get_guild(guild_id)
|
||||||
for recruit in recruits:
|
for recruit in recruits:
|
||||||
|
cur.execute("SELECT count(*) FROM yes_votes WHERE discord_id_recruit = ?", (recruit[1]))
|
||||||
|
yes_count = cur.fetchone()[0]
|
||||||
|
cur.execute("SELECT count(*) FROM no_votes WHERE discord_id_recruit = ?", (recruit[1]))
|
||||||
|
no_count = cur.fetchone()[0]
|
||||||
if recruit[2] != 0:
|
if recruit[2] != 0:
|
||||||
cur.execute("SELECT reason, discord_id_voter FROM no_votes WHERE discord_id_recruit = ?", (recruit[3], ))
|
cur.execute("SELECT reason, discord_id_voter FROM no_votes WHERE discord_id_recruit = ?", (recruit[1], ))
|
||||||
no_votes = cur.fetchall()
|
no_votes = cur.fetchall()
|
||||||
description = description + "**" + recruit[0] + ":** " + str(recruit[1]) + " Ja, " + str(recruit[2]) + " Nein.\n"
|
description = description + "**" + recruit[0] + ":** " + str(yes_count) + " Ja, " + str(no_count) + " Nein.\n"
|
||||||
for no_vote in no_votes:
|
for no_vote in no_votes:
|
||||||
description = description + "Begründung von " + guild.get_member(no_vote[1]).display_name + ": " + no_vote[0] + "\n"
|
description = description + "Begründung von " + guild.get_member(no_vote[1]).display_name + ": " + no_vote[0] + "\n"
|
||||||
description = description + "\n\n"
|
description = description + "\n\n"
|
||||||
else:
|
else:
|
||||||
description = description + "**" + recruit[0] + ":** " + str(recruit[1]) + " Ja, " + str(recruit[2]) + " Nein.\n"
|
description = description + "**" + recruit[0] + ":** " + str(yes_count) + " Ja, " + str(no_count) + " Nein.\n"
|
||||||
embed.description = description
|
embed.description = description
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user