Supported 0 votes

This commit is contained in:
jmueller
2023-12-11 18:31:44 +01:00
parent 8c3b9863e3
commit 227534caaa

33
main.py
View File

@@ -450,14 +450,28 @@ class delete_and_view_votes_message(discord.ui.View):
@discord.ui.button(label="Stimme auswählen und löschen", custom_id="delete-votes", style=discord.ButtonStyle.secondary)
async def delete_votes(self, button, interaction):
embed = discord.Embed(
title="Stimme löschen",
description="Wähle einen Rekruten aus, um deine Stimme für ihn zu löschen",
color=discord.Colour.blurple(), # Pycord provides a class with default colors you can choose from
)
delete_recruit_vote_inst = delete_recruit_vote()
delete_recruit_vote_inst.children[0].options = getvotes(interaction.user.id)
await interaction.response.send_message(embed=embed, view=delete_recruit_vote_inst, ephemeral=True)
cur.execute("SELECT count(yes_votes.id) FROM recruits, yes_votes WHERE recruits.discord_id = yes_votes.discord_id_recruit AND recruits.recruit = 1 AND yes_votes.discord_id_voter = ?", (interaction.user.id,))
yes_votes = cur.fetchone()[0]
cur.execute("SELECT count(no_votes.id) FROM recruits, no_votes WHERE recruits.discord_id = no_votes.discord_id_recruit AND recruits.recruit = 1 AND no_votes.discord_id_voter = ?", (interaction.user.id,))
no_votes = cur.fetchone()[0]
count = yes_votes + no_votes
if count == 0:
embed = discord.Embed(
title="Keine Stimmen gefunden.",
description="Du hast keine Stimmen abgeben! Zock mit den Rekruten und fang an!",
color=discord.Colour.blurple(), # Pycord provides a class with default colors you can choose from
)
embed.set_footer(text="Wenn du denkst, dass dies nicht korrekt ist, wende dich bitte an LordofAgents.")
await interaction.response.send_message(embed=embed, ephemeral=True)
else:
embed = discord.Embed(
title="Stimme löschen",
description="Wähle einen Rekruten aus, um deine Stimme für ihn zu löschen",
color=discord.Colour.blurple(), # Pycord provides a class with default colors you can choose from
)
delete_recruit_vote_inst = delete_recruit_vote()
delete_recruit_vote_inst.children[0].options = getvotes(interaction.user.id)
await interaction.response.send_message(embed=embed, view=delete_recruit_vote_inst, ephemeral=True)
def getvotes(voterid, part = 1):
@@ -580,6 +594,9 @@ async def message_voting(ctx):
conn.commit()
await ctx.respond(f"Done.", ephemeral=True)
# HIER
@settings.command(description="Sendet den Report in den aktuellen Kanal.")
@default_permissions(manage_roles=True)
async def message_report(ctx):