Ask coding questions

← Back to all posts
Why is this having a syntaxerror?
MrDeer (0)
async def on_message(message):
  if == client.user:

  if message.content.startswith('$hello'):

@client.command(pass_context = True)
async def join(ctx):
    if (
        channel =
        await channel.connect()
        await ctx.send('You are not in a voice channel, you must be in a voice channel to run this command!')

@client.command(pass_context = True)
async def leave(ctx):
    if (ctx.voice_client):
        await ctx.guild.voice_client.disconnect()
        await ctx.send('I left the Voice Channel')
        await ctx.send("I am not in a voice channel")

Its only the async def parts thats having this error.

Answered by QuickV (130) [earned 5 cycles]
View Answer
QuickV (130)

Like Coder100 said, line 10 is missing a ) at the end, so just add that on and it should be fine :P

Coder100 (18939)

Look at line 10:

you are missing a ). So change your line 10 to:

print('We have logged in as {0.user}'.format(client))

whenever you are dealing with nested parentheses, replit isn't super good with it and you will have to do it one more than the normal amount.