Skip to content
← Back to Community
Why is this having a syntaxerror?
Profile icon
MrDeer
@client.event async def on_message(message): if message.author == client.user: return if message.content.startswith('$hello'): await message.channel.send('Hello!') @client.command(pass_context = True) async def join(ctx): if (ctx.author.voice): channel = ctx.message.author.voice.channel await channel.connect() else: 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') else: await ctx.send("I am not in a voice channel")

Its only the async def parts thats having this error.

Answered by QuickV [earned 5 cycles]
View Answer
Voters
Profile icon
MrDeer
Comments
hotnewtop
Profile icon
QuickV

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

Profile icon
MrDeer

@QuickV Brooooo._.thx.

Profile icon
QuickV

No problem :) @MrDeer

Profile icon
Coder100

Look at line 10:

image

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.