Search code examples
pythondiscordpython-3.6nextcord

Discord Bot CommandNotFound


import nextcord
from nextcord import Interaction
from nextcord.ext import commands

# intents = nextcord.Intents.default()
intents= nextcord.Intents.all()
intents.message_content = True
intents.members = True

client = commands.Bot(command_prefix="!", intents=intents)


@client.event
async def on_ready():
    print("Bot is Ready For Use!")


testingServerID = "server id"


@client.slash_command(name='hello', description="Replies with Hello", guild_ids=[testingServerID])
async def hello(interaction: Interaction):
    await interaction.response.send_message("Hello There")


token = "my token token"
client.run(token)
'''
This is my first bot and I have asked people from discord but still no solution.
I have given it administrative prevailing, and every thing is needed from developers' side.
When I tried !hello and /hello, I get this error:

Bot is Ready For Use! Ignoring exception in command None: nextcord.ext.commands.errors.CommandNotFound: Command "hello" is not found


Solution

  • You didn't create a text command called hello
    you created a "SlashCommand"
    The bot doesn't create a text command when you create a SlashCommand.
    You either have to make a hybrid command (idk if it is avaliable in nextcord)

    To create a hello command that works seprate from the Slash Command
    You can try this:

    @client.command(name='hello', description="Replies with Hello")
    async def hello(ctx):
        await ctx.send("Hello There")