Click here to Skip to main content
15,942,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been working on a Discord bot using and I am fairly new to Python. I keep getting an error like this:

Traceback (most recent call last):
File "", line 34, in <module>
TypeError: event() missing 1 required positional argument: 'coro'

What I have tried:

I have looked over my code and other similar questions and my code is just like other people's and looks fine. Here is the specific part of the code that had the error:

async def on_message(message):
    if == bot.user:
    if not message.guild:
            await"This is a DM.")
        except discord.errors.Forbidden:

If anyone finds anything wrong with it, please tell me.

Updated 12-Aug-22 0:42am

Decorator bot.event() must not be called.

Refer API Reference : 1.4.1 documentation[^]

For async calls, don't use blocking library functions.
Share this answer
make bot.event() into bot.event

I think that is what Rajeev Jayaram meant but I didnt understand it.

(We used the same code snippet from stack overflow and ran into the same issue lol)
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900