Skip to content
syntax error :(
Profile icon

i've been trying to make a discord bot in python(unfinished) but i keep on getting a invalid syntax error on row do i fix this?

You are viewing a single comment. View All
Profile icon


your error is because on the line above 10, you have indented @client.event, this is wrong. Try this code.

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

you also have multiple indentation errors. Your overall code should look like this.

import discord client = discord.Client() @client.event async def on_ready(): print('We have logged in as {0.user}' .format (client)() @client.event async def on_message(message): if == client.user: return msg = message.content if message.content.startswith ('!help'): # added colon, and unintended await'nah') # indented

like that. Remember to only indent if you see a : on the line above.
Thats should work

Profile icon

I literally copy pasted your code, but it stills shows an error. pls help me

Profile icon

Not sure if you were ever able to figure out your issue, but I am having the exact same one. So if you were able to figure it out I would love to know what solution worked for you!