sync commands to guilds

This commit is contained in:
2022-10-28 14:18:52 +02:00
parent e6d8618229
commit f4ac1fb5d5

11
bot.py
View File

@ -29,6 +29,9 @@ class HeidiClient(discord.Client):
def __init__(self, *, intents: discord.Intents):
super().__init__(status="Nur eine kann GNTM werden!", intents=intents)
# Separate object that keeps all application command state
self.tree = app_commands.CommandTree(self)
self.prefix = "Heidi, "
self.prefix_regex = "^" + self.prefix
@ -59,6 +62,14 @@ class HeidiClient(discord.Client):
"sag .+$": self.say_voiceline
}
# Synchronize commands to guilds
async def setup_hook(self):
self.tree.copy_global_to(guild=LINUS_GUILD)
await self.tree.sync(guild=LINUS_GUILD)
self.tree.copy_global_to(guild=TEST_GUILD)
await self.tree.sync(guild=TEST_GUILD)
# Helpers ------------------------------------------------------------------------------------
def _help_text(self):