0

I am trying to add a suggestion command on my discord bot, but I get the following error: File "c:\Users\Shadow\Desktop\testbot.py", line 411 m = await client.get_channel(779765858066497536).send(embed=embed) ^ IndentationError: unindent does not match any outer indentation level

does anyone know how to fix it? my code will be below.

reactions = ["✅", "❌"]

@client.command()
async def suggest(ctx, *, question):
    embed=discord.Embed(title="Met Police Suggestion :white_check_mark")
    embed.add_field(name="Suggestion:", value=f"{question}")
    embed.add_field(name="Author:", value=f"{ctx.author.mention}")
    m = await client.get_channel(779765858066497536).send(embed=embed)
    for name in reactions:
        emoji = get(ctx.guild.emojis, name=name)
        await m.add_reaction(emoji or name)

I know it is something to do with indenting, but I've tried all sorts of indenting and it just won't work.

pat222
  • 1
  • 1
    Have you mixed up tabs and spaces here? This is a python trap - stick to one style (I use spaces). – Danny Staple Dec 16 '20 at 17:37
  • i used tabs the whole time – pat222 Dec 16 '20 at 17:39
  • The code you've posted does not produce the error you're getting. If you use an editor that lets you view both tabs and spaces, do you consistently see only tabs or spaces in the script? If you see both then that's probably the issue. – Random Davis Dec 16 '20 at 17:40
  • @DannyStaple If you use VSCode, it should insert tabs as spaces. – Sachin Raja Dec 16 '20 at 20:24
  • I usually use vscode, and indeed take advantage of the tab keys as spaces. I've also used pycharm in the same way. Perhaps you meant the op? – Danny Staple Dec 16 '20 at 23:15
  • Reviewing the [raw source](https://stackoverflow.com/revisions/4bc51ba8-cf67-49fa-bc3e-4832ef4c7b7b/view-source) for this post shows that you did indeed mix up tabs and spaces. The lines `m = await client.get_channel(779765858066497536).send(embed=embed)` and `for name in reactions:` start with four spaces, and the following lines with eight spaces. The previous lines, manipulating `embed`, start with a tab. – Karl Knechtel Jul 14 '23 at 20:25

0 Answers0