my discord bot code from this vid https://www.youtube.com/watch?v=SPTfmiYiuok says this error

my discord bot from this vid Code a Discord Bot with Python - Host for Free in the Cloud - YouTube says this error

Ignoring exception in on_ready
Traceback (most recent call last):
File “/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py”, line 343, in _run_event
await coro(*args, **kwargs)
File “main.py”, line 15, in on_ready
if message.content.startswith(’$hello’):
NameError: name ‘message’ is not defined

it logs in but wont work with commands as well this is my code

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’))

1 Like