Fixed the command so it actually works
This commit is contained in:
@ -53,15 +53,18 @@ class Nessa(discord.Client):
|
|||||||
|
|
||||||
@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.")
|
||||||
@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: str):
|
||||||
if interaction.user.id == OWNER_ID:
|
try:
|
||||||
guild = self.get_guild(guild_id)
|
guild_id_int = int(guild_id)
|
||||||
|
guild = self.get_guild(guild_id_int)
|
||||||
if guild is None:
|
if guild is None:
|
||||||
await interaction.response.send_message("Guild not found.", ephemeral=True)
|
await interaction.response.send_message("Guild not found.", ephemeral=True)
|
||||||
return
|
return
|
||||||
await self.tree.sync(guild=discord.Object(id=guild))
|
await self.tree.sync(guild=discord.Object(id=guild_id_int))
|
||||||
self.tree.copy_global_to(guild=discord.Object(id=guild))
|
self.tree.copy_global_to(guild=discord.Object(id=guild_id_int))
|
||||||
await interaction.response.send_message(f"Commands synced successfully for guild {guild.name}.", ephemeral=True)
|
await interaction.response.send_message(f"Commands synced successfully for guild {guild.name}.", ephemeral=True)
|
||||||
|
except ValueError:
|
||||||
|
await interaction.response.send_message("Invalid guild ID.", ephemeral=True)
|
||||||
|
|
||||||
async def on_ready(self):
|
async def on_ready(self):
|
||||||
print(f"Logged on as {self.user}!")
|
print(f"Logged on as {self.user}!")
|
||||||
|
Reference in New Issue
Block a user