我正在使用node.js模块处理一个不和谐的机器人
discord.js
.
最近一个错误出现在启动(当机器人试图登录)时,使用工作wifi,我认为是配置的某种方式,导致它打破。
(node:104) UnhandledPromiseRejectionWarning: FetchError: request to https://discordapp.com/api/v7/gateway/bot failed, reason: read ECONNRESET
at RequestHandler.execute (C:\Users\user\Desktop\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:106:9)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:104) 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: 1)
(node:104) [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.
从文件中引发错误
RequestHandler.js
使用APIRequest
方法
make
从文件中
APIRequest.js
返回函数的结果
fetch
从文件中
index.js
它返回一个
rejected promise
.
变量
req
是
ClientRequest
(来自模块
_http_client
)
returned
从方法
request
从https模块。
如果我把
req.on('error', function (err) { ... });
然后我得到以下错误:
events.js:167
throw er;
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)
Emitted 'error' event at:
at TLSSocket.socketErrorListener (_http_client.js:391:9)
at TLSSocket.emit (events.js:182:13)
at emitErrorNT (internal/streams/destroy.js:82:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
at process._tickCallback (internal/process/next_tick.js:63:19)
我相信是从
here
但它是node.js的内部模块(
internal/stream_base_commons.js
)我无法编辑并继续深入跟踪必须要编辑和重新编译这不是我知道怎么做。
当我去
https://discordapp.com/api/v7/gateway/bot
我得到的答复是:
{"code": 0, "message": "401: Unauthorized"}
我需要帮助了解原始错误的确切原因以及是否有任何解决方法来继续运行bot。