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?
your error is because on the line above 10, you have indented @client.event, this is wrong. Try this code.
10
@client.event
@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
:
syntax error :(
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?
Solution
your error is because on the line above
10
, you have indented@client.event
, this is wrong. Try this code.you also have multiple indentation errors. Your overall code should look like this.
like that. Remember to only indent if you see a
:
on the line above.Thats should work