modified: bot.py

This commit is contained in:
SimolZimol
2024-09-12 19:11:00 +02:00
parent 648eb9e5af
commit c237a65b39

6
bot.py
View File

@@ -401,6 +401,8 @@ async def check_giveaway(giveaway_id):
@client.event
async def on_interaction(interaction):
"""Bearbeitet die Teilnahme an einem Giveaway."""
# Überprüfen, ob es sich um eine Button-Interaktion handelt und ein custom_id vorhanden ist
if interaction.type == discord.InteractionType.component and "custom_id" in interaction.data:
if interaction.data["custom_id"].startswith("giveaway_"):
giveaway_id = int(interaction.data["custom_id"].split("_")[1])
giveaway = giveaways.get(giveaway_id)
@@ -414,6 +416,10 @@ async def on_interaction(interaction):
await interaction.response.send_message("Du hast erfolgreich am Giveaway teilgenommen!", ephemeral=True)
else:
await interaction.response.send_message("Du nimmst bereits am Giveaway teil.", ephemeral=True)
else:
# Logge Interaktionen, die nicht den erwarteten Typ haben
logger.error(f"Unbekannte Interaktion: {interaction.type}, Daten: {interaction.data}")
def read_introduction():
try: