diff options
author | 2023-04-29 22:44:55 +0800 | |
---|---|---|
committer | 2023-04-29 22:44:55 +0800 | |
commit | d0ca29eb3d65915336cb6a3218c80cb41452bdc5 (patch) | |
tree | b96fa3fe050c6bc843562fa6a8f9eb679892779e | |
parent | Update on-message-event.md (diff) |
Apply suggestions from code review
Co-authored-by: wookie184 <[email protected]>
-rw-r--r-- | bot/resources/tags/on-message-event.md | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/bot/resources/tags/on-message-event.md b/bot/resources/tags/on-message-event.md index 35a841f87..5227db98c 100644 --- a/bot/resources/tags/on-message-event.md +++ b/bot/resources/tags/on-message-event.md @@ -6,13 +6,11 @@ embed: Registering the `on_message` event with [`@bot.event`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.event) will override the default behavior of the event. This may cause prefix commands to stop working, because they rely on the default `on_message` event. Instead, use [`@bot.listen`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.listen) to add a listener. Listeners get added alongside the default `on_message` event, rather than overriding it, so prefix commands can still be invoked as usual: - ```python @bot.listen('on_message') async def message_listener(message): ... # do stuff here ``` - You can also tell discord.py to process commands as usual after you're done processing messages with [`bot.process_commands()`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.Bot.process_commands). However, this method isn't recommended as it does not allow you to add multiple `on_message` handlers. ```python |