From b3dfd48fb4ab676d5e3fe2711ebb92ad1809bfab Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 13 Aug 2024 23:40:49 -0400 Subject: [PATCH] FIX: Corrected an error with commands --- user/birthday.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/user/birthday.py b/user/birthday.py index 37ed37d..fb76395 100644 --- a/user/birthday.py +++ b/user/birthday.py @@ -21,7 +21,6 @@ def __init__(self, client): # Ensure that the database and tables are set up self.ensure_db() - self.setup_commands() def ensure_db(self): os.makedirs(os.path.dirname(self.db_path), exist_ok=True) @@ -119,7 +118,7 @@ async def set_birthday_channel(interaction: discord.Interaction, channel: discor self.set_birthday_channel(guild_id, channel.id) await interaction.response.send_message(f"Birthday alerts will now be sent to {channel.mention}.", ephemeral=True) - self.client.tree.add_command(set_birthday_channel) + @tree.command(name="consent", description="Give consent for data storage.") async def consent_command(interaction: discord.Interaction): self.consent_manager.give_consent(interaction.user.id, interaction.guild.id) @@ -162,6 +161,8 @@ async def get_birthday_command(interaction: discord.Interaction): tree.add_command(set_birthday_command) if not tree.get_command("get_birthday"): tree.add_command(get_birthday_command) + if not tree.get_command("set_birthday_channel"): + tree.add_command(set_birthday_channel) class BirthdayModal(discord.ui.Modal, title="Set your birthday"):