discord.py command is not found

Viewed 628

the bot keeps giving me this error:

Ignoring exception in command None:
discord.ext.commands.errors.CommandNotFound: Command "rs" is not found

import discord
from discord.ext import commands
from datetime import datetime
from discord import client

print("holaaaaaa")
token = "token"
client = commands.Bot(command_prefix=("."))

contatore1 = 0
redstar = "@everyone Vorrei fare una rs "
partecipanti = "\n Partecipanti: "

support = "0/4"

@client.event
async def on_ready():
    print(client.user, "ONLINE ","(ID ", client.user.id,")")

@commands.command()
async def rs(message):
    if message.channel.id == 605465213956915218:
        global redstar
        global contatore5
        global tag5
        global support5
        global partecipanti
        redstar = "@everyone Vorrei fare una " + message.channel.name
        tag5 = "\n" + message.author.mention
        contatore5 = 1
        if (contatore5 == 1):
            support5 = "1/4"
            await message.send(redstar + partecipanti + support5 + tag5)
    if (message.channel.id == 605465543134150657):
        global contatore6
        global tag6
        global support6
        redstar = "@everyone Vorrei fare una " + message.channel.name
        tag6 = "\n" + message.author.mention
        contatore6 = 1
        if (contatore6 == 1):
            support6 = "1/4"
            await message.send(redstar + partecipanti + support6 + tag6)

client.run(token)

Also, it should be noted that the on_ready event runs.
Any help is appreciated thanks :)

1 Answers

There are 2 ways you can go on about fixing your problem.

  • The one suggested by Dominik where you would need to change your @commands.command() to @client.command(). So like change

    @commands.command()
    async def rs(message):
    

    to

    @client.command()
    async def rs(message):
    
  • Manually adding the command afterward using bot.add_command. With this you would have to add

    client.add_command(rs)
    

    somewhere below the command definition and above the client.run.

I personally suggest the first method since it's more concise.

Related