This commit is contained in:
xeals 2023-04-26 17:06:33 +10:00
parent a65137307b
commit a926461f8f
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C

7
bot.py
View File

@ -72,10 +72,9 @@ class BotClient(discord.Client):
return message.content.startswith("%") return message.content.startswith("%")
async def on_command(self, message: discord.Message): async def on_command(self, message: discord.Message):
command = message.content.split(" ")[0] match message.content.split(" "):
match command: case ["%calc", *args]:
case "%calc": reply = await self._calculate(args)
reply = await self._calculate(command[1:])
await message.reply(content=reply) await message.reply(content=reply)
case _: case _:
_log.info(f"Unrecognised command {command}") _log.info(f"Unrecognised command {command}")