mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 23:55:46 +02:00
Reduce db load for custom commands
This commit is contained in:
parent
5f72701714
commit
fa129efd0c
1 changed files with 7 additions and 2 deletions
|
|
@ -215,9 +215,14 @@ class Didier(commands.Bot):
|
|||
if not message.content.startswith(settings.DISCORD_CUSTOM_COMMAND_PREFIX):
|
||||
return False
|
||||
|
||||
# Remove the prefix
|
||||
content = message.content[len(settings.DISCORD_CUSTOM_COMMAND_PREFIX) :].strip()
|
||||
|
||||
# Message was just "?" (or whatever the prefix was configured to)
|
||||
if not content:
|
||||
return False
|
||||
|
||||
async with self.postgres_session as session:
|
||||
# Remove the prefix
|
||||
content = message.content[len(settings.DISCORD_CUSTOM_COMMAND_PREFIX) :]
|
||||
command = await custom_commands.get_command(session, content)
|
||||
|
||||
# Command found
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue