Fixed an error

This commit is contained in:
Dan
2024-05-05 21:16:48 -04:00
parent de18257c3e
commit 5d3068ebc9

View File

@ -23,9 +23,9 @@ class Nessa(discord.Client):
self.tree.copy_global_to(guild=discord.Object(id=GUILD_ID)) self.tree.copy_global_to(guild=discord.Object(id=GUILD_ID))
await self.tree.sync(guild=discord.Object(id=GUILD_ID)) await self.tree.sync(guild=discord.Object(id=GUILD_ID))
def is_owner_or_admin(interaction: discord.Interaction): def is_owner_or_admin(interaction: discord.Interaction):
"""Check if the user is the bot owner or an administrator in the guild.""" """Check if the user is the bot owner or an administrator in the guild."""
return interaction.user.id == OWNER_ID or interaction.user.guild_permissions.administrator return interaction.user.id == OWNER_ID or interaction.user.guild_permissions.administrator
@self.tree.command(name="shutdown", description="Shut down Nessa", guild=discord.Object(id=GUILD_ID)) @self.tree.command(name="shutdown", description="Shut down Nessa", guild=discord.Object(id=GUILD_ID))
async def shutdown(interaction: discord.Interaction): async def shutdown(interaction: discord.Interaction):
@ -52,7 +52,7 @@ class Nessa(discord.Client):
await interaction.response.send_message("I've passed on your issue to the Chief!", ephemeral=True) await interaction.response.send_message("I've passed on your issue to the Chief!", ephemeral=True)
@self.tree.command(name="sync_commands", description="Force sync commands in a specific guild.") @self.tree.command(name="sync_commands", description="Force sync commands in a specific guild.")
@self.app_commands.check(is_owner_or_admin) # or @discord.app_commands.checks.is_owner() @app_commands.check(is_owner_or_admin) # or @discord.app_commands.checks.is_owner()
async def sync_commands(interaction: discord.Interaction, guild_id: int): async def sync_commands(interaction: discord.Interaction, guild_id: int):
if interaction.user.id == OWNER_ID: if interaction.user.id == OWNER_ID:
guild = self.get_guild(guild_id) guild = self.get_guild(guild_id)