Skip to content

Commit

Permalink
Refine help command text
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhijeetKrishnan committed Feb 19, 2024
1 parent 10eb367 commit 63cff4e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
30 changes: 15 additions & 15 deletions src/heihachi/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ async def on_message(self, message: discord.Message) -> None:
else:
logger.debug(f"Message from {message.author.name} in {message.guild} does not mention the bot")

def _character_command_factory(
self, name: str
) -> Callable[[discord.Interaction["FrameDataBot"], str], Coroutine[Any, Any, None]]:
"A factory function to create /character command functions"
# def _character_command_factory(
# self, name: str
# ) -> Callable[[discord.Interaction["FrameDataBot"], str], Coroutine[Any, Any, None]]:
# "A factory function to create /character command functions"

async def _character_command(interaction: discord.Interaction["FrameDataBot"], move: str) -> None:
logger.info(f"Received command from {interaction.user.name} in {interaction.guild}: /{name} {move}")
if not (self._is_user_blacklisted(str(interaction.user.id)) or self._is_author_newly_created(interaction)):
embed = get_frame_data_embed(self.framedb, self.frame_service, name, move)
await interaction.response.send_message(embed=embed, ephemeral=False)
# async def _character_command(interaction: discord.Interaction["FrameDataBot"], move: str) -> None:
# logger.info(f"Received command from {interaction.user.name} in {interaction.guild}: /{name} {move}")
# if not (self._is_user_blacklisted(str(interaction.user.id)) or self._is_author_newly_created(interaction)):
# embed = get_frame_data_embed(self.framedb, self.frame_service, name, move)
# await interaction.response.send_message(embed=embed, ephemeral=False)

return _character_command
# return _character_command

async def _character_name_autocomplete(
self, interaction: discord.Interaction["FrameDataBot"], current: str
Expand Down Expand Up @@ -126,11 +126,11 @@ async def _frame_data_cmd(interaction: discord.Interaction["FrameDataBot"], char
embed = get_frame_data_embed(self.framedb, self.frame_service, character_name_query, move_query)
await interaction.response.send_message(embed=embed, ephemeral=False)

for character in CharacterName:
char_name = character.value
self.tree.command(name=char_name, description=f"Frame data from {char_name}")(
self._character_command_factory(char_name)
)
# for character in CharacterName:
# char_name = character.value
# self.tree.command(name=char_name, description=f"Frame data from {char_name}")(
# self._character_command_factory(char_name)
# )

if self.config.feedback_channel_id and self.config.action_channel_id:

Expand Down
30 changes: 17 additions & 13 deletions src/heihachi/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,31 +132,35 @@ def get_help_embed(frame_service: FrameService) -> discord.Embed:
"""Returns the help embed message for the bot."""

embed = discord.Embed(
title="Heihachi Frame Data Bot help",
title="Heihachi help",
colour=SUCCESS_COLOR,
description="Heihachi is a bot that provides frame data for Tekken 8.",
description="Heihachi is a Discord bot that provides frame data for Tekken 8, primarily from Wavu Wiki.",
)
embed.set_thumbnail(url=frame_service.icon)
embed.add_field(
name="Commands list",
value="Type `/` to view a list of slash commands.",
name="/fd `<character>` `<move>`",
value="Get frame data for a particular character's move.",
inline=False,
)
embed.add_field(
name="Frame data",
value="Use `/fd <character> <move>` to get frame data for a particular character's move.\n"
"For example, \n`* /fd kazuya 1,1,2`\n`* /fd azu engager`\n* `/fd bryan ff2`\n"
"The bot is somewhat forgiving with typos and will try to find the closest match.",
name="/feedback `message`",
value="Send feedback to the bot authors in case of incorrect frame data (or any other reason).",
inline=False,
)
embed.add_field(
name="Feedback",
value="use `/feedback <message>` to send feedback to the bot authors in case of incorrect frame data (or any other reason).",
name="/help",
value="Display this message.",
inline=False,
)
embed.add_field(
name="Help",
value="Use `/help` to display this message.",
name="Wavu Wiki",
value="[Homepage](https://wavu.wiki/t/Main_Page) - [Discord](http://discord.gg/86UFj8GEcC) - [Twitter](https://twitter.com/wavuwiki)",
inline=False,
)
embed.add_field(
name="More links", value="[Wavu Wiki](https://wavu.wiki/t/Main_Page) - [GitHub](https://github.com/TLNBS2405/heihachi)"
name="Contributing",
value="Heihachi is open source. Follow the project on [GitHub](https://github.com/TLNBS2405/heihachi).",
inline=False,
)
embed.set_footer(text=frame_service.name, icon_url=frame_service.icon)
return embed
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
stream_handler = logging.StreamHandler()
stream_handler.setFormatter(formatter)
logger.addHandler(stream_handler)
logger.setLevel(logging.INFO)
logger.setLevel(logging.DEBUG)


def periodic_function(
Expand Down

0 comments on commit 63cff4e

Please sign in to comment.