Skip to content

Commit

Permalink
Fix bug that each first time a character is used during /<character_n…
Browse files Browse the repository at this point in the history
…ame>, an error occured
  • Loading branch information
TLNBS2405 committed Mar 11, 2024
1 parent 5327ccf commit 1b37075
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/heihachi/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1b37075

Please sign in to comment.