fix formatting
This commit is contained in:
parent
699a833285
commit
4b07aeb10c
10
bot.py
10
bot.py
@ -74,9 +74,11 @@ class BotClient(discord.Client):
|
||||
async def on_command(self, message: discord.Message):
|
||||
match message.content.split(" "):
|
||||
case ["%calc", *args]:
|
||||
reply = await self._calculate(args)
|
||||
if reply:
|
||||
await message.reply(content=reply.strip())
|
||||
try:
|
||||
calc = await self._calculate(args)
|
||||
await message.reply(content=calc.strip())
|
||||
except Exception as e:
|
||||
await message.reply(content="```\n" + str(e) + "\n```")
|
||||
case _:
|
||||
_log.info(f"Unrecognised command {command}")
|
||||
|
||||
@ -86,7 +88,7 @@ class BotClient(discord.Client):
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
_log.error(f"running calculator: {proc.stderr}")
|
||||
return proc.stdout
|
||||
return proc.stdout.decode()
|
||||
|
||||
def is_replay(self, message: discord.Message) -> bool:
|
||||
if re.match("https://replay.pokemonshowdown.com/dl-.*", message.content):
|
||||
|
Loading…
Reference in New Issue
Block a user