Skip to content
← Back to Community
syntax error :(
Profile icon
FunnySusMan420

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

Voters
Profile icon
ch1ck3n
Profile icon
FunnySusMan420
Comments
hotnewtop
Profile icon
RYANTADIPARTHI

Solution

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 message.author == 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 message.author == client.user: return msg = message.content if message.content.startswith ('!help'): # added colon, and unintended await message.channel.send('nah') # indented client.run(ODEwNDM3NzAzNzMyNjkwOTc1.YCjo7Q.WuS1lDpDMzuC23IP588brRHcVRc)

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

Profile icon
VinPetrolGod

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

Profile icon
Chickenpotato2

@VinPetrolGod 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!