Skip to content

Commit

Permalink
Merge pull request #95 from Vatsim-Scandinavia/feature/training-roles
Browse files Browse the repository at this point in the history
New method for sync commands
  • Loading branch information
Marko259 authored Sep 27, 2024
2 parents cd59fa0 + 6b26c53 commit 6b0c5bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions cogs/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6b0c5bf

Please sign in to comment.