# Python Discord Bot doesn't work, shows NO errors

**URL:** <https://forum.freecodecamp.org/t/python-discord-bot-doesnt-work-shows-no-errors/450889>\
**Category:** General\
**Created:** [March 12, 2021, 9:51pm UTC](https://forum.freecodecamp.org/t/python-discord-bot-doesnt-work-shows-no-errors/450889 "2021-03-12T21:51:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anxhelaalushi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/anxhelaalushi/32/209433_2.png) [@anxhelaalushi](https://forum.freecodecamp.org/u/anxhelaalushi)\
**Post date:** [March 12, 2021, 9:51pm UTC](https://forum.freecodecamp.org/t/python-discord-bot-doesnt-work-shows-no-errors/450889/1 "2021-03-12T21:51:10Z")

</div>

I was following the YT tutorial on how to code a Discord bot on Python, and after writing the exact code as the video showed and following the exact same steps, the bot still does nothing when i give it commands.

The video I am referring to is [Code a Discord Bot with Python - Host for Free in the Cloud - YouTube](https://www.youtube.com/watch?v=SPTfmiYiuok&t=31s&ab_channel=freeCodeCamp.org)

Here’s the code I wrote, did I do anything wrong but can’t see it?

```auto
import discord
import os

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!')

client.run(os.getenv('TOKEN'))

```

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [March 12, 2021, 9:52pm UTC](https://forum.freecodecamp.org/t/python-discord-bot-doesnt-work-shows-no-errors/450889/2 "2021-03-12T21:52:03Z")

</div>

indentation is an important syntax feature in python, it indicates what’s inside of what  
if your indentation doesn’t match it is not going to do the same thing

---

<div class="post-metadata">

**Author:** ![anxhelaalushi](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/anxhelaalushi/32/209433_2.png) [@anxhelaalushi](https://forum.freecodecamp.org/u/anxhelaalushi)\
**Post date:** [March 12, 2021, 9:54pm UTC](https://forum.freecodecamp.org/t/python-discord-bot-doesnt-work-shows-no-errors/450889/3 "2021-03-12T21:54:32Z")

</div>

Thank you so much! It works now.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [September 11, 2021, 9:54am UTC](https://forum.freecodecamp.org/t/python-discord-bot-doesnt-work-shows-no-errors/450889/4 "2021-09-11T09:54:46Z")

</div>

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