-1

I have an error with my discord bot but when I run the program for the discord bot, it works, but the command with the invalid syntax doesn't work.

@client.command()
@commands.has_permissions(kick_members=True)
async def warn(ctx, member: discord.Member, *, reason):
      save_warn(ctx, member)
      dm = await bot.fetch_user(member.id)
      em=discord.Embed(title="Warning", description=f"Server: {ctx.guild.id}\nReason: {reason}"
      await dm.send(embed=em)

With this command, I get the invalid syntax error, can someone help me please?!

The syntax error says:

File "main.py", line 154
    await dm.send(embed=em)
    ^
SyntaxError: invalid syntax

Thanks!

Exotic
  • 19
  • 4
  • 2
    you simply forgot a closing bracket. If it was the only problem I'm happy to have helped. In this case you can sign the answer as accepted to make others understand that it worked for you. – FLAK-ZOSO Dec 25 '21 at 17:23

1 Answers1

1

You are missing a closing ) in the previous line.


When Python raises a SyntaxError or says Invalid Syntax remember to always check the line that precedes the code indicated by the Traceback.

FLAK-ZOSO
  • 3,873
  • 4
  • 8
  • 28
  • I'm getting the error: Console Log: Command raised an exception: JSONDecodeError: Expecting value: line 1 column 1 (char 0) – Exotic Dec 25 '21 at 17:24
  • 1
    @Exotic, that's a completely separate error. You should post that as a separate question. – Daniel Walker Dec 25 '21 at 17:25
  • This is a problem much different from the SyntaxError that took you here. Anyway you can read this answer: https://stackoverflow.com/questions/16573332/jsondecodeerror-expecting-value-line-1-column-1-char-0 – FLAK-ZOSO Dec 25 '21 at 17:25