I have a problem with creating a discord bot where it wont answer my "command"

Viewed 36

I am stuck with creating a bot for discord. I want it to recognize my message and then say "Hello" to it but because of whatever it does not work. I am sure it has the right permissions.

import discord
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.startwith('$hello'):
        await message.channel.send('Hello!')
client.run(TOKEN)
    

I am very new to programming but I know that since the API from discord got changed you have to give "intents". But I dont know if this could be the problem I changed it from:

client = dsicord.Client()

to

client = discord.Client(intents=discord.Intents.default())

*this code makes my bot appear online

0 Answers
Related