Error on discord commando A command with the name/alias "${command.name}" is already registered

115 views Asked by At

I am using Node.js Discord.js-commando, I try to run my code but this comes up please tell me if you are having the same error or have a fix. The code under is from the index.js for your help. Please reply to this message and tell me if you know ut

C:\Users\james\OneDrive\Desktop\Discover Now\node_modules\discord.js-commando\src\registry.js:129
                        throw new Error(`A command with the name/alias "${command.name}" is already registered.`);
                        ^

Error: A command with the name/alias "help" is already registered.
    at CommandoRegistry.registerCommand (C:\Users\james\OneDrive\Desktop\Discover Now\node_modules\discord.js-commando\src\registry.js:129:10)
    at CommandoRegistry.registerCommands (C:\Users\james\OneDrive\Desktop\Discover Now\node_modules\discord.js-commando\src\registry.js:176:9)
    at CommandoRegistry.registerCommandsIn (C:\Users\james\OneDrive\Desktop\Discover Now\node_modules\discord.js-commando\src\registry.js:200:15)
    at Object.<anonymous> (C:\Users\james\OneDrive\Desktop\Discover Now\index.js:67:4)
    at Module._compile (node:internal/modules/cjs/loader:1102:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
    at Module.load (node:internal/modules/cjs/loader:967:32)
    at Function.Module._load (node:internal/modules/cjs/loader:807:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47

This is my code/ command handler in my index.js I have 5 categories each with their own name. Please rply with a a answer if u have one


client.registry
  .registerDefaultTypes()
  .registerGroups([
    ["fun", "Fun Commands"],
    ["moderation", "Moderation Commands"],
    ["special", "Special Commands"],
    ["misc", "Misc Commands"],
    ["music", "Music Commands"]
  ])
  .registerDefaultGroups()
  .registerDefaultCommands()
  .registerCommandsIn(path.join(__dirname, "commands"));


1

There are 1 answers

0
binoy638 On

You can do two things here, either change your custom command from help to something else like commands or disable the default command help provided by commando.

To disable commando's default help command you can do this

client.registry
  .registerDefaultTypes()
  .registerGroups([
    ["fun", "Fun Commands"],
    ["moderation", "Moderation Commands"],
    ["special", "Special Commands"],
    ["misc", "Misc Commands"],
    ["music", "Music Commands"]
  ])
    .registerDefaultGroups()
    .registerDefaultCommands({
      help: false,
      prefix: true,
      ping: true,
      eval: true,
      unknownCommand: true,
      commandState: true,
    })
  .registerCommandsIn(path.join(__dirname, "commands"));