0

i made a discord bot in python but every time i add this to my script, the commands stop working:

@client.event
async def on_message(message):
  message=message.content
  print(message)

Does somebody know, how to fix that? Thanks in advance!!!!

Namechange
  • 31
  • 6
  • 2
    Does this answer your question? [Why does on\_message stop commands from working?](https://stackoverflow.com/questions/49331096/why-does-on-message-stop-commands-from-working) – Łukasz Kwieciński Jul 01 '21 at 20:33

1 Answers1

0

add this line to your code:

await bot.process_commands(message)

for Example:

@bot.event
async def on_message(message):
    # do some extra stuff here

    await bot.process_commands(message)

Don't Use In "Cogs".

  • Hello, first thank you really much for helping me, but i get this error: `AttributeError: 'str' object has no attribute 'author` Do you or someone else how I can fix that? – Namechange Jul 02 '21 at 08:10
  • edit you'r Q and add all of on_message code. –  Jul 02 '21 at 08:50