From 1b37075cf4c7ce6d9985bdb623e4ed585433a083 Mon Sep 17 00:00:00 2001 From: lnguy Date: Mon, 11 Mar 2024 12:58:18 +0100 Subject: [PATCH] Fix bug that each first time a character is used during /, an error occured --- src/heihachi/bot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/heihachi/bot.py b/src/heihachi/bot.py index f647404..ad672d3 100644 --- a/src/heihachi/bot.py +++ b/src/heihachi/bot.py @@ -34,6 +34,9 @@ def __init__( self.tree = discord.app_commands.CommandTree(self) self._add_bot_commands() + for char in CharacterName: + self.tree.command(name=char.value, description=f"Frame data from {char.value}")(self._character_command_factory(char.value)) + logger.debug(f"Bot command tree: {[command.name for command in self.tree.get_commands()]}") async def on_ready(self) -> None: @@ -107,8 +110,8 @@ async def _character_name_autocomplete( def _add_bot_commands(self) -> None: "Add all frame commands to the bot" - for char in CharacterName: - self.tree.command(name=char.value, description=f"Frame data from {char.value}")(self._character_command_factory(char.value)) + + @self.tree.command(name="fd", description="Frame data from a character move") @discord.app_commands.autocomplete(character=self._character_name_autocomplete)