diff options
author | 2023-04-29 22:55:27 +0800 | |
---|---|---|
committer | 2023-04-29 22:55:27 +0800 | |
commit | 79e4dfdcd23b6af8fd1e7c6c7a4ea8f44aaa673d (patch) | |
tree | 1208e6150b93c552c5f064cc9bc6beae93dc7682 | |
parent | Remove example of not recommended solution (diff) |
Update on-message-event.md
-rw-r--r-- | bot/resources/tags/on-message-event.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bot/resources/tags/on-message-event.md b/bot/resources/tags/on-message-event.md index fe18a453a..54980c03f 100644 --- a/bot/resources/tags/on-message-event.md +++ b/bot/resources/tags/on-message-event.md @@ -3,7 +3,7 @@ embed: title: "The discord.py `on_message` event" --- -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. +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 handler. 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 @@ -11,6 +11,6 @@ Instead, use [`@bot.listen`](https://discordpy.readthedocs.io/en/stable/ext/comm 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. +You can also tell discord.py to process the message for commands as usual at the end of the `on_message` handler 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. -If your prefix commands are still not working, it may be because you need the `message_content` intent. See `!tag message_content` for more info. +If your prefix commands are still not working, it may be because you haven't enabled the `message_content` intent. See `!tag message_content` for more info. |