From 6b26c53a9dda8a1a552ea77309eb4424b7ecbc0d Mon Sep 17 00:00:00 2001 From: Marko259 Date: Sat, 28 Sep 2024 00:07:57 +0200 Subject: [PATCH] New method for sync commands --- bot.py | 6 +----- cogs/tasks.py | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 213ae06..b50855c 100644 --- a/bot.py +++ b/bot.py @@ -39,14 +39,10 @@ @bot.event async def on_ready() -> None: print(f'Bot started. \nUsername: {bot.user.name}. \nID: {bot.user.id}', flush=True) - guild = bot.get_guild(GUILD_ID) try: await bot.change_presence(activity=config.activity(), status=config.status()) - if guild: - await bot.tree.sync(guild=guild) # Sync commands to a specific guild for faster deployment - else: - await bot.tree.sync() # Sync global commands (might take up to 1 hour to reflect globally) + await bot.tree.sync() # Sync global commands (might take up to 1 hour to reflect globally) except BadArgument as e: print(f'Error changing presence. Exception - {e}', flush=True) except discord.HTTPException as e: diff --git a/cogs/tasks.py b/cogs/tasks.py index eed968e..a330048 100644 --- a/cogs/tasks.py +++ b/cogs/tasks.py @@ -111,6 +111,7 @@ async def sync_commands(self, override=False): try: if guild: await self.bot.tree.sync(guild=guild) # Sync commands to a specific guild for faster deployment + print(f'Commands has been synced for guild {guild}', flush=True) else: await self.bot.tree.sync() # Sync global commands (might take up to 1 hour to reflect globally) except discord.HTTPException as e: