Search code examples
pythondiscordbotsnextcord

nextcord error, nextcord.ext.commands.errors.CommandNotFound


I started nextcord to develop a discord bot, but I don't understand it well from the beginning.

When I type !youtube with slash_command in discord, I get this result, but I don't know where I went wrong..

GUILD_ID & Token deleted for secure

from nextcord import Interaction, SlashOption, ChannelType
from nextcord.abc import GuildChannel
from nextcord.ext import commands
import nextcord

GUILD_ID = 
bot = commands.Bot(command_prefix='!')

@bot.event
async def on_ready():
    print("Ready")

@bot.slash_command(guild_ids=[GUILD_ID])
async def youtube(interaction : Interaction):
    await interaction.response.send_message("hi")

bot.run('')

result Ignoring exception in command None: nextcord.ext.commands.errors.CommandNotFound: Command "youtube" is not found


Solution

  • If you type / in your message field in discord should pop up something where you can select bots and commands. Click on your bot's icon and check if your 'youtube' command is there. If yes just click it and hit enter. Also you can remove this line: bot = commands.Bot(command_prefix='!') if you only use Slash Commands because they work without a custom command prefix