Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我得到了一个“答案”;未处理的PromisejectionWarning“;及;“弃用警告”;在尝试运行Bot的代码时,有什么解决方案可以解决此问题?_Javascript_Node.js_Discord_Discord.js - Fatal编程技术网

Javascript 我得到了一个“答案”;未处理的PromisejectionWarning“;及;“弃用警告”;在尝试运行Bot的代码时,有什么解决方案可以解决此问题?

Javascript 我得到了一个“答案”;未处理的PromisejectionWarning“;及;“弃用警告”;在尝试运行Bot的代码时,有什么解决方案可以解决此问题?,javascript,node.js,discord,discord.js,Javascript,Node.js,Discord,Discord.js,我正在尝试为服务器创建一个不协调的Bot,我在终端中输入“节点。”以运行Bot,但出现以下错误: (node:17632) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided. at WebSocketConnection.<anonymous> (C:\Users\Thela\code\node_modules\discord.js\src\client\Cli

我正在尝试为服务器创建一个不协调的Bot,我在终端中输入“
节点。
”以运行Bot,但出现以下错误:

    (node:17632) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided.
    at WebSocketConnection.<anonymous> (C:\Users\Thela\code\node_modules\discord.js\src\client\ClientManager.js:48:41)
    at Object.onceWrapper (events.js:300:26)
    at WebSocketConnection.emit (events.js:210:5)
    at WebSocketConnection.onClose (C:\Users\Thela\code\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:390:10)
    at WebSocket.onClose (C:\Users\Thela\code\node_modules\ws\lib\event-target.js:124:16)
    at WebSocket.emit (events.js:210:5)
    at WebSocket.emitClose (C:\Users\Thela\code\node_modules\ws\lib\websocket.js:191:10)
    at TLSSocket.socketOnClose (C:\Users\Thela\code\node_modules\ws\lib\websocket.js:850:15)
    at TLSSocket.emit (events.js:215:7)
    at net.js:658:12
(node:17632) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either 
by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:17632) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 
下面是config.json:

{
"prefix": "!",
"token": "7F2x4ct0AMuBeJKZUGmtIz_RZVKve-N4"
}
我意识到我没有把全部的错误都放进去 oops

您所使用的“令牌”实际上是您的客户机机密,令牌应如下所示:


NjQwOTM2MjE3MTg5Mjg1ODg4.XcGSOQ.3dgX4GbvEDZKYHnCb6nJORuvL1w在这里发布令牌是否安全…?真正的错误是
错误:提供了不正确的登录详细信息。
Promise
部分是另一个问题。@appleapple这不是另一个错误,看起来是登录承诺没有得到处理,这是导致错误的原因。@thomasreichman承诺拒绝不是真正的错误,这里的问题是承诺不应该被拒绝。是的,我知道,代码中的config.json“token”中有一行:“7F2x4ct0AMuBeJKZUGmtIz_RZVKve-N4”也是的,我已经显示了我的token,并重新生成了它。你不明白我的意思,我知道你的token在配置文件中,配置文件中的不是你的token,而是你的客户机密,只是比较一下两者,一个比另一个短得多。转到discord仪表板,创建一个bot并获取实际的bot令牌
{
"prefix": "!",
"token": "7F2x4ct0AMuBeJKZUGmtIz_RZVKve-N4"
}