N
N
NeoLight22021-01-06 10:56:44
Python
NeoLight2, 2021-01-06 10:56:44

Why when I add async def on_message function other functions stop working?

I have my own bot in Python, I made commands for it, etc.
But there is a problem if I add this function in the code, which receives messages from the user:

@client.event
async def on_message(message):
    print(message.channel.name) 
    print(message.channel.id)


Then the rest of the commands for the clients stop working, that is, if you enter a command for the bot in the discord, it will not respond.

How can this be resolved?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2021-01-06
@NeoLight2

https://discordpy.readthedocs.io/en/latest/faq.htm...

N
Nikolay Baranenko, 2017-03-25
@drno-reg

managed to solve the problem in this way
within the same subnet, the intersection in the names of the listener key KEY = EXTPROC2002 was excluded

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question