sync commands to guilds
This commit is contained in:
11
bot.py
11
bot.py
@ -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):
|
||||
|
Reference in New Issue
Block a user