Discord Bot IndentationError- line 15

I was doing the tutorial for making a discord bot
( FreeCodeCamp’s Discord Bot Tutorial
I have no clue what i did wrong.

Please post your code instead of a screenshot.

In Python, indentation has meaning. You need to use the same number of spaces when you indent.

import discord
import os

client = discord.Client()

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

async def on_message(message):
  if message.author == client.user: 
 if message.content.startswith('$hello'):
    await message.channel.send('Hello!')


this is my exact code

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

the indentation is an important part of python syntax, you need to have the second if statement match the indentation of the first one

1 Like

Most of the programming languages like C, C++ and Java use braces { } to define a block of code. But Python uses indentation. A code block starts with indentation and ends with the first un-indented line. Generally four white spaces are used for indentation and is preferred over tab spaces. So please use indentation very carefully.
It is noticed that the indentation is not consistent injyour code.