Making discord bot with Python

Viewed 47

Making a mention message for discord bot

   @client.event
async def ze_message(msg):
    bot = f'<@{client.user.id}>'
          if message.content == bot:

    await message.channel.send("If you need any help type .help")

and this is what it says

       if message.content == bot:
IndentationError: unexpected indent`
2 Answers

Imports should be without indent.

Tip: Get a good IDE such as pycharm and or vscode. These tools will give you much more feedback.

It's important to write your code the way you should:

@client.event
async def ze_message(msg):
    bot = f'<@{client.user.id}>'
        if message.content == bot:
            await message.channel.send("If you need any help type .help")

After ":" the following code needs 4 more spaces then before.

And also do not confuse intents with indents

But I think there are more problems with your code than just the indents.

e.g. Did you mean to writeasync def ze_message(msg): if you want to use discords function you might want to call it async def on_message(msg): ...

Related