handle error

This commit is contained in:
xeals 2023-04-26 17:12:24 +10:00
parent a926461f8f
commit 648deb83db
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C

4
bot.py
View File

@ -81,7 +81,9 @@ class BotClient(discord.Client):
async def _calculate(self, args: list[str]) -> str:
proc = sp.run(["node", "calc_main.js", "--"] + args)
msg = proc.stdout
if proc.returncode != 0:
_log.error(f"running calculator: {proc.stderr}")
msg = proc.stdout or ""
return msg.strip()
def is_replay(self, message: discord.Message) -> bool: