Discord.py command can't be called

Question:

Running this code and running command after on_ready does not print anything in console.

import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!', description="This is a Helper Bot")
userasbot = "NoUser"
@bot.command()
async def hello(ctx):
    print("Hello")
    await ctx.send("Hello, world!")
@bot.event
async def on_ready():
    print("Ready!")
bot.run('Token')

Older code I wrote before that has worked before does not do anything too now. Did the library get updated?

Asked By: Python User

||

Answers:

If you have an on_message(message) function, you need to process the command using await bot.process_commands(message).

Answered By: walker
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.