Я работаю с ботом Discord с помощью модуля node.js discord.js .
В последнее время появляется ошибка при запуске (когда бот пытается войти в систему) при использованиирабочий Wi-Fi, который, я считаю, был настроен каким-то образом, что привело к его поломке.
(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
, который возвращает отклоненное обещание .
переменную req
- это ClientRequest
(из модуля _http_client
) , возвращено из метода request
из модуля https.
Если я закомментирую req.on('error', function (err) { ... });
, то получу следующую ошибку:
events.js:167
throw er; // Unhandled 'error' event
^
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)
Который, как я считаю, будет выброшен из здесь но это внутренний модуль Node.js (internal/stream_base_commons.js
), который я не могу редактировать и продолжаю отслеживать глубже.Пришлось бы отредактировать и перекомпилировать, что я не умею делать.
Когда я перехожу на https://discordapp.com/api/v7/gateway/bot, я получаю ответ:
{"code": 0, "message": "401: Unauthorized"}
Мне нужна помощь в пониманииточная причина первоначальной ошибки, и если есть какие-либо обходные пути для продолжения работы бота.