Problem with discord bot tut

I have been scripting of if the discord bot tutorial using python on YouTube.

I came across this error will I was scripting it.

Help is very appreciated thanks


Please copy and post your code instead of taking pictures of your computer. Pictures can be really hard to read. Thanks.

1 Like
import discord


client = discord.Client()

@client.event
async def on_ready():
  print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
   if message.author == client.user:
     return

  if message.content.startswith('!hello'):
    await message.channel.send('Hello!')

TOKEN IS HERE

The indentation of the two if statements do not match.

No clue what that means

A Discord bot can be a hard place to lean Python.

In Python, whitespace has logical/syntactic meaning. You need to use consistent numbers of spaces when indenting commands.

Okay, is there any chance someone can just help me with the problem.

We’re trying to.

This line

and this line

aren’t indented the same number of spaces. You need to use your spacebar and/or delete button to fix this problem.

Then you need to do a similar fix here:

You might want to focus on some Python basics and then circle back to this - bots are hard, and doubly so if you don’t know the language well.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.