This commit is contained in:
xeals 2023-04-26 17:04:36 +10:00
parent 0afca583b0
commit a65137307b
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C

4
bot.py
View File

@ -75,12 +75,12 @@ class BotClient(discord.Client):
command = message.content.split(" ")[0]
match command:
case "%calc":
reply = await _calculate(command[1:])
reply = await self._calculate(command[1:])
await message.reply(content=reply)
case _:
_log.info(f"Unrecognised command {command}")
async def _calculate(args: list[str]) -> str:
async def _calculate(self, args: list[str]) -> str:
proc = sp.run(["node", "calc_main.js", "--"] + args)
msg = proc.stdout
return msg.strip()