必须指定值

时间:2018-06-10 11:08:12

标签: javascript node.js discord.js

我正在研究discord bot,但是当我尝试使用任何命令时,我都会收到此错误。   操作系统:Windows 10   语言:Java版本8更新171
  代码:https://pastebin.com/jDLspKF6

错误:     C:\用户\宏基\桌面\ C \ node_modules \ discord.js的\ src \ UTIL \ Collection.js:195           if(typeof value ==='undefined')抛出新错误('必须指定值。');                                             ^

Error: Value must be specified.
    at Map.find (C:\Users\Acer\Desktop\c\node_modules\discord.js\src\util\Collection.js:195:47)
    at Client.bot.elevation.message [as elevation] (C:\Users\Acer\Desktop\c\app.js:53:40)
    at Client.module.exports.message (C:\Users\Acer\Desktop\c\events\message.js:8:24)
    at Client.emit (events.js:182:13)
    at MessageCreateHandler.handle (C:\Users\Acer\Desktop\c\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\Acer\Desktop\c\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\Acer\Desktop\c\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\Acer\Desktop\c\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\Acer\Desktop\c\node_modules\ws\lib\event-target.js:120:16)
    at WebSocket.emit (events.js:182:13)

有人能帮助我吗?

1 个答案:

答案 0 :(得分:0)

错误来自第53行的app.js(来自您的错误:at Client.bot.elevation.message [as elevation] (C:\Users\Acer\Desktop\c\app.js:53:40)

在第53行的代码中,您使用了Collection.find(),并且您可能传递了未定义的参数:请检查settings.json以确保modrolename存在; )