Harden prefix code to accept more inputs
This commit is contained in:
parent
98a02adc2f
commit
a2439e9824
1 changed files with 2 additions and 2 deletions
4
bot.py
4
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 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),
|
# 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
|
# so I'm just manually handling the command here before passing to the command handler
|
||||||
if message.content[0] == PREFIX:
|
if message.content.startswith(PREFIX):
|
||||||
first_token = message.content.split()[0][1:]
|
first_token = message.content[len(PREFIX):].strip().split()[0]
|
||||||
if first_token in self.custom_commands:
|
if first_token in self.custom_commands:
|
||||||
await message.channel.send(self.custom_commands[first_token])
|
await message.channel.send(self.custom_commands[first_token])
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue