0

我正在使用 Node.js Discord.js-commando,我尝试运行我的代码,但出现这种情况请告诉我您是否遇到相同的错误或有修复。下面的代码来自 index.js,供您参考。请回复此消息并告诉我您是否知道

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

这是我的 index.js 中的代码/命令处理程序,我有 5 个类别,每个类别都有自己的名称。如果你有一个答案,请回复


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"));


4

0 回答 0