2021年4月29日星期四

Why do I keep getting a error saying the command already exists, when it clearly does not?

here is the full code of my bot, just to show you that I have not used help in any place else except the help command. It's so confusing lol.

import asyncio  from discord.ext import commands    #todo  #Eco bot  #Leveling bot  #Help        #bot  token = 'token'  bot = commands.Bot(command_prefix='w')  #getting ID's    # list of banned words  filtered_words = ['bad words']    #help command  @bot.command(aliases=['help'])  async def help(ctx):      author = ctx.message.author        embed = discord.Embed(          colour = Discord.Colour.blue      )        embed.set_author(name='help')      embed.add_feild(name='clear', value='Alises: c, clean. Deleted a specified number of messages in the chat history.', inline=False)    @bot.event  async def on_ready():      print("Hello I am online and ready!")      #Bot status      await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(bot.guilds)} server(s)"))    # Group message clearing (purge)  @bot.command(aliases=['c', 'clear'])  @commands.has_permissions(manage_messages = True)  async def clean(ctx, amount: int):      amount += 1      await ctx.channel.purge(limit = amount)      amount -= 1      msg = f"You've deleted {amount} messages"      await ctx.send(msg, delete_after=10)    # auto mod  @bot.event  async def on_message(msg):      for word in filtered_words:          if word in msg.content:              await msg.delete()      await bot.process_commands(msg)    @bot.event  async def on_message_delete(msg):      if msg.author.id != 835676293625282601:          channel = bot.get_channel(398176354392342529)          del_msg = await channel.send(":eyes:")          await del_msg.send(del_msg)          await asynciaito.sleep(10)          await del_msg.delete()    bot.run(token)  

The problem is these lines, it says help is already defined, but it isn't? I've had the same problem with the clean command when I used clear instead of clean. it just kept saying that the command was already being used. it's so confusing to me lol.

@bot.command(aliases=['help'])  async def help(ctx):      author = ctx.message.author        embed = discord.Embed(          colour = Discord.Colour.blue      )        embed.set_author(name='help')      embed.add_feild(name='clear', value='Alises: c, clean. Deleted a specified number of messages in the chat history.', inline=False)  

below is the error code:

discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.  
https://stackoverflow.com/questions/67328007/why-do-i-keep-getting-a-error-saying-the-command-already-exists-when-it-clearly April 30, 2021 at 12:00PM

没有评论:

发表评论