Add Remove Votes command

This commit is contained in:
Jonathan Müller
2025-06-30 19:23:02 +02:00
parent dd97aa12fa
commit 7e86b09dae

12
main.py
View File

@@ -728,6 +728,8 @@ async def message_voting(ctx):
await send_delete_message(ctx.channel)
await ctx.respond(f"Done.", ephemeral=True)
class report_select_menu25(discord.ui.View):
@discord.ui.select( # the decorator that lets you specify the properties of the select menu
placeholder = "Rekruten wählen...", # the placeholder text that will be displayed if nothing is selected
@@ -958,6 +960,16 @@ async def guild(ctx):
cur.execute("UPDATE settings SET VALUE = ? WHERE name = 'guild'", (ctx.guild_id, ))
await ctx.respond(f"Done.", ephemeral=True)
@settings.command(description="Entfernt alle Stimmen von einem Rekruten")
@default_permissions(manage_roles=True)
async def remove_votes(ctx, first: discord.Option(discord.SlashCommandOptionType.user)):
with DBConnection() as cur:
cur.execute("SELECT id FROM recruits WHERE discord_id = ?", (first.id,))
recr_id = cur.fetchone()
cur.execute("DELETE FROM yes_votes WHERE discord_id_recruit = ?", (first.id, ))
cur.execute("DELETE FROM no_votes WHERE discord_id_recruit = ?", (first.id, ))
await ctx.respond(f"Done.", ephemeral=True)
def check_roles(member, recruit_id):
for role in member.roles:
if role.id == recruit_id: