我正在尝试使用Visual Studio Code中的JavaScript编码discord bot,但我一直收到一个错误,即Command名称必须小写

时间:2018-02-11 03:24:57

标签: javascript node.js visual-studio discord

我正在尝试使用Visual Studio Code中的JavaScript编码discord bot,但我一直收到一个错误,即Command名称必须小写。

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\tjcol\Documents\bot_v1> node .
C:\Users\tjcol\Documents\bot_v1\node_modules\discord.js-commando\src\commands\base.js:52
                if(info.name !== info.name.toLowerCase()) throw new Error('Command name must be lowercase.');
                                                          ^

Error: Command name must be lowercase.
    at new Command (C:\Users\tjcol\Documents\bot_v1\node_modules\discord.js-commando\src\commands\base.js:52:51)
    at new TotalQCommand (C:\Users\tjcol\Documents\bot_v1\commands\random\totalQ.js:5:9)
    at CommandRegistry.registerCommands (C:\Users\tjcol\Documents\bot_v1\node_modules\discord.js-commando\src\registry.js:114:48)
    at CommandRegistry.registerCommandsIn (C:\Users\tjcol\Documents\bot_v1\node_modules\discord.js-commando\src\registry.js:166:15)
    at Object.<anonymous> (C:\Users\tjcol\Documents\bot_v1\index.js:6:14)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)

1 个答案:

答案 0 :(得分:0)

根据discord.js-commando的文档,您的命令名称必须小写。

请参阅Command - &gt; CommandInfo文档:

PARAMETER   TYPE    OPTIONAL    DEFAULT DESCRIPTION
name        string              The name of the command (must be lowercase)
...

您可以在Commando Github repo中看到引发错误并在控制台输出中引用的代码行 - if(info.name !== info.name.toLowerCase()) throw new Error('Command name must be lowercase.');