How can i fix this line of code?

basically this is meant to stop my bot from replying to itself
Screenshot 2022-06-23 10.29.00 AM

Please provide the error message and the repl link.

it’s not posted
Screenshot 2022-06-23 12.04.58 PM

also the code has some personal stuff so yeah

@caisright11 Please do not share screenshots of code and errors. Instead, copy and paste it here.

Oh, i’m really sorry

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

Hmmm, I’m not too sure about this one. Are there any nullified characters before async?
Did you try @client.event() instead of @client.event ?

just tried it. It didn’t work

btw the error is invalid syntax

Do you get an error without the async?

Yes I do get an error when removing the async. Any idea what’s wrong?

Mabey replaces client.user with the id of the bot.

How could i find the id? Is it the token?

Check out this artical How to Find your User ID on Discord - TechSwift

thanks, ill try it as soon as i can

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.