'Discord.py commands not running

**

** UPDATE: SOLVED

Hi, So im making a bot with the code below in python and i cant figure out why the commands arent working in discord. the only one that works is the one that i stole from the docs website. i removed some other commands that dont work but even just a reply command didnt work. my print to terminal script doesnt work either. my code is below lmk about a solution:

(i removed the libraries and stuff for simplicity in this post)

#sets prefix and loads intents
client = commands.Bot(command_prefix = "!", intents = discord.Intents.default())


#on ready message log in terminal
@client.event
async def on_ready():
    print('bot online')    


#hello command which btw is the only one that works rn
@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('!hello'):
        await message.channel.send('Hello!')

#ping ms command
@client.command()
async def ping(ctx):
    await ctx.channel.send(f'Pong! {round(client.latency * 1000)}ms')



#set status
@client.event
async def on_ready():
    await client.change_presence(activity = discord.Game('being useless'))



client.run(token)

there hasnt been anything to try because no one in the discord server could reproduce or figure out my issue.



Solution 1:[1]

await bot.process_commands(message)

Code example:

@client.event
async def on_message(message):
if message.author == client.user:
    return

if message.content.startswith('!hello'):
    await message.channel.send('Hello!')
else:
    await client.process_commands(message)

Solution 2:[2]

await bot.process_commands(message.content)

Your now working code:

#sets prefix and loads intents
client = commands.Bot(command_prefix = "!", intents = discord.Intents.default())


#on ready message log in terminal
@client.event
async def on_ready():
    print('bot online')    


#hello command which btw is the only one that works rn
@client.event
async def on_message(message):
    if message.author == client.user:
        return

    if message.content.startswith('!hello'):
        await message.channel.send('Hello!')
    else:
       await bot.process_commands(message.content)
    

#ping ms command
@client.command()
async def ping(ctx):
    await ctx.channel.send(f'Pong! {round(client.latency * 1000)}ms')

#set status
@client.event
async def on_ready():
    await client.change_presence(activity = discord.Game('being useless'))

client.run(token)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 yusufYAZICI155
Solution 2