fix calculator help

This commit is contained in:
xeals 2023-04-27 11:41:11 +10:00
parent 53ece70381
commit e3dc7301e4
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C

17
bot.py
View File

@ -73,7 +73,7 @@ class BotClient(discord.Client):
async def on_command(self, message: discord.Message): async def on_command(self, message: discord.Message):
match re.split(" +", message.content): match re.split(" +", message.content):
case ["%calc?"], ["%calc", "?"]: case ["%calc?"] | ["%calc", "?"]:
await message.reply(content=self._help_calculate()) await message.reply(content=self._help_calculate())
case ["%calc", *args]: case ["%calc", *args]:
try: try:
@ -85,15 +85,16 @@ class BotClient(discord.Client):
content="```\n" + str(e) + "\n```", delete_after=10 content="```\n" + str(e) + "\n```", delete_after=10
) )
case _: 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: async def _help_calculate(self) -> str:
return """ return (
Run Showdown damage calculations. "Run Showdown damage calculations.\n"
Example format: "Example format:\n"
` %calc -2 8 SpA Choice Specs Torkoal Overheat vs. 252 HP / 4+ SpD Assault Vest Abomasnow in Sun through Light Screen` "` %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. "Supported: attacker/defender boosts, EVs, item, species; attacker ability; weather/terrain; screens."
""" )
async def _calculate(self, args: list[str]) -> str: async def _calculate(self, args: list[str]) -> str:
proc = sp.run( proc = sp.run(