Commit 7812a1d
committed
Avoid waiting for message when bot will not see it
Previously, the code below the if-statement will always execute if eat
is False. In guilds where the bot only has the applications.commands scope, or guilds
with the bot scope where the bot cannot read the channel's messages, the bot will
not find SlashContext.message and will time out after 3 seconds. This unnecessary
wait slows down command execution.
With this change, the bot will only check for messages if one of the
following conditions are true:
- SlashContext.guild_id is None (i.e. command executed in a private DM)
or
- SlashContext.channel is not None (i.e. command executed in a guild with the bot scope),
and the bot has permission to view messages in the command's channel.1 parent 9cb4bb3 commit 7812a1d
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
0 commit comments