Discord bot only responds per dm

Viewed 49

I'm trying to write a discord bot but he only responds to dms and not when I'm writing in a channel on a server:

import discord

class MyClient(discord.Client):
    async def on_ready(self):
        print("I'm Online")

    async def on_message(self, message):
        if message.author == client.user:
            return
        else : print("Message from" + str(message.author) + ": " + str(message.content))
        if message.content.startswith("Hello Bot") :
            await message.channel.send("Hello")

client = MyClient(intents=discord.Intents.default())
client.run("my token")

I don't know why it isn't working.

0 Answers
Related