L
L
Lol Likovic2020-07-01 07:24:12
Python
Lol Likovic, 2020-07-01 07:24:12

How to make the bot in discord and commands able to read, and messages too?

I am writing a bot in python and ran into a problem. If I write: He, of course, reads commands, but if I write after that:
client = commands.Bot( command_prefix = '!')

@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('$hello'):
        await message.channel.send('Hello!')

Then he will start to read only messages from me, but he will forget about the commands at all
How to do both?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2020-07-01
@Lolik666

This is a very popular question, which comes first in the FAQ in the official documentation.
https://discordpy.readthedocs.io/en/latest/faq.htm...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question