Whenever I run my discord python code, and test it in the discord chat, it says the ping command is not found even though I defined it in the code.
I've tried to use both Bot and Client and both gave the same error.
import discord
from discord.ext import commands
bot_prefix= "]"
bot = commands.Bot(command_prefix=bot_prefix)
bot.run("*")
@bot.event
async def on_ready():
print("ok")
@bot.event
async def on_message(message):
print(message.content)
@bot.command()
async def ping(ctx):
latency = bot.latency
await ctx.send(latency)
Personal information replaced with "*"
The bot should send a message in the user's channel saying the latency of the bot, but instead I just get an error that says: "Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "ping" is not found" even though I defined the ping command in the code.
Also, it should be noted that the on_ready event never runs; I never get the print statement in the console log.
Any help is appreciated thanks :)