From e3dc7301e41c3269e780e7351ee3bc25e809462c Mon Sep 17 00:00:00 2001 From: xeals Date: Thu, 27 Apr 2023 11:41:11 +1000 Subject: [PATCH] fix calculator help --- bot.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bot.py b/bot.py index 1177ba4..a1764f0 100755 --- a/bot.py +++ b/bot.py @@ -73,7 +73,7 @@ class BotClient(discord.Client): async def on_command(self, message: discord.Message): match re.split(" +", message.content): - case ["%calc?"], ["%calc", "?"]: + case ["%calc?"] | ["%calc", "?"]: await message.reply(content=self._help_calculate()) case ["%calc", *args]: try: @@ -85,15 +85,16 @@ class BotClient(discord.Client): content="```\n" + str(e) + "\n```", delete_after=10 ) case _: - _log.info(f"Unrecognised command {command}") + _log.info(f"Unrecognised command {message.content}") + await message.reply(content="Unrecognised command.") async def _help_calculate(self) -> str: - return """ - Run Showdown damage calculations. - Example format: - ` %calc -2 8 SpA Choice Specs Torkoal Overheat vs. 252 HP / 4+ SpD Assault Vest Abomasnow in Sun through Light Screen` - Supported: attacker/defender boosts, EVs, item, species; attacker ability; weather/terrain; screens. - """ + return ( + "Run Showdown damage calculations.\n" + "Example format:\n" + "` %calc -2 8 SpA Choice Specs Torkoal Overheat vs. 252 HP / 4+ SpD Assault Vest Abomasnow in Sun through Light Screen`\n" + "Supported: attacker/defender boosts, EVs, item, species; attacker ability; weather/terrain; screens." + ) async def _calculate(self, args: list[str]) -> str: proc = sp.run(