From a3f904c5a1381e9df9c69490b31f5c3295c5f41f Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Fri, 9 Aug 2024 23:32:40 +0200 Subject: [PATCH] Fix --- src/services/discord.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/services/discord.py b/src/services/discord.py index 06a02de..d61a5f1 100644 --- a/src/services/discord.py +++ b/src/services/discord.py @@ -19,15 +19,16 @@ class DiscordClient(discord.Client): self.tree = app_commands.CommandTree(self) + async def setup_hook(self): + self.tree.copy_global_to(guild=Object(id=config.DISCORD_GUILD_ID)) + await self.tree.sync(guild=Object(id=config.DISCORD_GUILD_ID)) + async def on_ready(self): await self.change_presence( activity=discord.Game(config.DISCORD_BOT_ACTIVITY), status=discord.Status.online, ) - self.tree.copy_global_to(guild=Object(id=config.DISCORD_GUILD_ID)) - await self.tree.sync(guild=Object(id=config.DISCORD_GUILD_ID)) - client = DiscordClient()