import discord
import os
my_token = os.environ['token']
client = discord.Client(intents=discord.Intents.default())
@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(my_token)
The bot only responds to the ‘$hello’ command when it’s a direct message, but when I try on my server nothing happens.