From a2439e98249604e2cf4f8d2e1c7a207763b7229f Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Tue, 13 Sep 2022 23:04:41 -0400 Subject: [PATCH] Harden prefix code to accept more inputs --- bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index 5a7c4a9..ef71ebc 100644 --- a/bot.py +++ b/bot.py @@ -38,8 +38,8 @@ class Bot(commands.Bot): # I really want to do this with the add_command function and have no need for this event_message override, but # I cannot for the life of me figure out how to make "anonymous" coroutines (like, async lambda or something), # so I'm just manually handling the command here before passing to the command handler - if message.content[0] == PREFIX: - first_token = message.content.split()[0][1:] + if message.content.startswith(PREFIX): + first_token = message.content[len(PREFIX):].strip().split()[0] if first_token in self.custom_commands: await message.channel.send(self.custom_commands[first_token]) return