0

Why am I getting this error: Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "Test" is not found

I saw other posts about this but the problem was them either not having their token or the bot.run(TOKEN) at the bottom

*EDIT Here's the updated code, still get the same error

import discord
from dotenv import load_dotenv
from discord.ext import commands

load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
GUILD = os.getenv('DISCORD_GUILD')

bot = commands.Bot(command_prefix='$', case_insensitive=True)

@bot.event
async def on_ready():
    for guild in bot.guilds:
        if guild.name == GUILD:
            break

    print(
        f'{bot.user} is connected to the following guild:\n'
        f'{guild.name}(id: {guild.id})'
    )

@bot.command()
async def on_message(ctx, arg):
    if ctx.author == bot.user:
        return
        
    if ctx.content.startswith('hello'):
        await ctx.channel.send(arg)

bot.run(TOKEN)


bot.run(TOKEN)
2
  • 1
    Commands are case-sensitive, unless you set case_insensitive to True when instantiating the Bot Commented Feb 25, 2022 at 22:00
  • I've added the case_insensitive and it still doesn't work. Commented Feb 25, 2022 at 22:22

1 Answer 1

1

your code is basically right. There's a "spelling" mistake in the command that you wrote in the chat. You should use $test instead of $Test while entering the command. However, you can avoid these mistakes by setting case_insensitive to True

With your example it would look like this:

bot = commands.Bot(command_prefix='$', case_insensitive=True)

This should work

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.