discord.py

Discord.py How to make the bot check every new message?


I'm using Discord.py how can I make the bot execute some operations when a user post a new message?


Solution

  • You can use a client event and on_message to check every new message:

    @client.event
    async def on_message(message):
        if message.content == "Hi":
            await message.channel.send("Hello!")