discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.4k stars 3.97k forks source link

Bot silently disconnects from Discord. #2601

Closed LeNitrous closed 5 years ago

LeNitrous commented 6 years ago

Please describe the problem you are having in as much detail as possible: Bot silently disconnects when left on for hours. The issue probably not related with my own code. Uploaded is the runtime when it occured. runtime.log

Further details:

Minor. Restarting should make it work again but it's a pain to restart it every now and then.

YoussefExplicit commented 6 years ago

I thought this issue was fixed in 11.3.2? Are you sure your discord.js version is 11.3.2?

LeNitrous commented 6 years ago

I made sure before writing up this issue. image

YoussefExplicit commented 6 years ago

Looks like the issue is back and it's up to the devs to find out, again.

Ensjam commented 6 years ago

Same issue here

MartijnHols commented 6 years ago

Nvm, turns out it was a ReDOS vulnerability, so even if my server doesn't have any loops it still was my own fault.

Bob620 commented 5 years ago

Having the same issue here on the latest master branch (11.4.2) on node 9.8.0 on RHEL-7.3_HVM_GA-20161026-x86_64-1-Hourly2-GP2 on AWS. Been having it silently disconnect anywhere from 1 minute to 2 days after restarting it.

Not a sharding issue since I only run a single instance of it at the moment.

xonrsoftware commented 5 years ago

Same issue on master. Simple roles bot goes silently offline. I'm using pm2.

code ```js try { const Discord = require('discord.js'); const client = new Discord.Client({ fetchAllMembers: true }); var fs = require('fs'); client.on('ready', async () => { await client.user.setStatus('invisible'); setInterval(function () { client.user.setStatus('invisible'); }, 600000); }); client.on('error', (error) => { console.log("Error d.js!"); process.exit(); }); client.on('message', async msg => { if (msg.channel.id == "478312979843252234") { if (msg.author.bot == false) { if (!msg.content.match(/^!(.*)/)) { await msg.author.send('```asciidoc\nНеправильно указана команда. ::  \n```\nКоманда боту должна начинаться с **!**.\nПодробный список команд находится в <#485413029551276032>.'); } /* else if (msg.content.match(/^!tournament/i) || msg.content.match(/^!to/i) || msg.content.match(/^!турнир/i) || msg.content.match(/^!ту/i)) { var timestamp = Math.floor(Date.now() / 1000); if (timestamp < 1533762000) { if (!msg.member.roles.has('359329601102544906')) { msg.member.addRole('359329601102544906').then((role) => { msg.member.send("```fix\nВам была выдана роль участия в турнире.\nЕсли вы решите не участвовать в турнире, то пропишите команду получения роли ещё раз, это уберёт её.\n```"); msg.member.addRole('359329601102544906'); msg.member.addRole('404810535347945483'); return role; }); } else { if (msg.member.roles.has('359329601102544906')) { msg.member.removeRole('359329601102544906').then((role) => { msg.member.send("```fix\nУ вас больше нет роли участия в турнире.\n```"); return role; }); } } } else msg.member.send("```fix\nЗакрыта регистрация на турнир, обратитесь к администрации.\n```"); }*/ else if (msg.content.match(/^!следопыт/i) || msg.content.match(/^!pathfinder/i)) { if (!msg.member.roles.has('336631550861115394')) { await msg.member.roles.add(['404810535347945483', '336631550861115394']); await msg.member.send("```fix\nВам была выдана тематическая роль по настольной ролевой игре Pathfinder.\n```"); } else { await msg.member.roles.remove('336631550861115394'); await msg.member.send("```fix\nУ вас больше нет тематической роли по настольной ролевой игре Pathfinder.\n```"); } } else if (msg.content.match(/^!лавкрафт/i) || msg.content.match(/^!lovecraft/i)) { if (!msg.member.roles.has('336629380996399115')) { await msg.member.roles.add(['404810535347945483', '336629380996399115']); await msg.member.send("```fix\nВам была выдана тематическая роль по настольным играм Лавкрафта.\n```"); } else { await msg.member.roles.remove('336629380996399115'); await msg.member.send("```fix\nУ вас больше нет тематической роли по настольным играм Лавкрафта.\n```"); } } else if (msg.content.match(/^!ттспират/i) || msg.content.match(/^!ttspirate/i)) { if (!msg.member.roles.has('479701746013437954')) { await msg.member.roles.add(['404810535347945483', '479701746013437954']); await msg.member.send("```fix\nВам была выдана тематическая роль пирата Tabletop Simulator.\n```"); } else { await msg.member.roles.remove('479701746013437954'); await msg.member.send("```fix\nУ вас больше нет тематической роли пирата Tabletop Simulator.\n```"); } } else if (msg.content.match(/^!otherplatform/i) || msg.content.match(/^!другаяплатформа/i) || msg.content.match(/^!otp/i)) { if (!msg.member.roles.has('468289785312837632')) { await msg.member.roles.add(['404810535347945483', '468289785312837632']); await msg.member.send("```fix\nВам была выдана тематическая роль по другим платформам.\n```"); } else { await msg.member.roles.remove('468289785312837632'); await msg.member.send("```fix\nУ вас больше нет тематической роли по другим платформам.\n```"); } } else if (msg.content.match(/^!tabletopia/i) || msg.content.match(/^!тейблтопия/i) || msg.content.match(/^!ttp/i)) { if (!msg.member.roles.has('468286292430422016')) { await msg.member.roles.add(['404810535347945483', '468286292430422016']); await msg.member.send("```fix\nВам была выдана тематическая роль по платформе Tabletopia.\n```"); } else { await msg.member.roles.remove('468286292430422016'); await msg.member.send("```fix\nУ вас больше нет тематической роли по платформе Tabletopia.\n```"); } } else if (msg.content.match(/^!vassal/i) || msg.content.match(/^!вассал/i) || msg.content.match(/^!vs/i)) { if (!msg.member.roles.has('468285710470742046')) { await msg.member.roles.add(['404810535347945483', '468285710470742046']); await msg.member.send("```fix\nВам была выдана тематическая роль по платформе Vassal.\n```"); } else { await msg.member.roles.remove('468285710470742046'); await msg.member.send("```fix\nУ вас больше нет тематической роли по платформе Vassal.\n```"); } } else if (msg.content.match(/^!бсг/i) || msg.content.match(/^!bsg/i)) { if (!msg.member.roles.has('336631789525139457')) { await msg.member.roles.add(['404810535347945483', '336631789525139457']); await msg.member.send("```fix\nВам была выдана тематическая роль по настольной игре BattleStar Galactica.\n```"); } else { await msg.member.roles.remove('336631789525139457'); await msg.member.send("```fix\nУ вас больше нет тематической роли по настольной игре BattleStar Galactica.\n```"); } } else if (msg.content.match(/^!евро/i) || msg.content.match(/^!euro/i)) { if (!msg.member.roles.has('466596648013922315')) { await msg.member.roles.add(['404810535347945483', '466596648013922315']); await msg.member.send("```fix\nВам была выдана тематическая роль по настольным евро играм.\n```"); } else { await msg.member.roles.remove('466596648013922315'); await msg.member.send("```fix\nУ вас больше нет тематической роли по настольным евро играм.\n```"); } } else if (msg.content.match(/^!зомбицид/i) || msg.content.match(/^!zombicide/i)) { if (!msg.member.roles.has('336629680692264961')) { await msg.member.roles.add(['404810535347945483', '336629680692264961']); await msg.member.send("```fix\nВам была выдана тематическая роль по настольный игре Зомбицид.\n```"); } else { await msg.member.roles.remove('336629680692264961'); await msg.member.send("```fix\nУ вас больше нет тематической роли по настольный игре Зомбицид.\n```"); } } else if (msg.content.match(/^!патигейм/i) || msg.content.match(/^!partygame/i)) { if (!msg.member.roles.has('357560162447261699')) { await msg.member.roles.add(['404810535347945483', '357560162447261699']); await msg.member.send("```fix\nВам была выдана тематическая роль по настольным компанейским играм.\n```"); } else { await msg.member.roles.remove('357560162447261699'); await msg.member.send("```fix\nУ вас больше нет тематической роли по настольным компанейским играм.\n```"); } } else if (msg.content.match(/^!свояигра/i) || msg.content.match(/^!sigame/i)) { if (!msg.member.roles.has('511658760389918740')) { await msg.member.roles.add(['404810535347945483', '511658760389918740']); await msg.member.send("```fix\nВам была выдана тематическая роль по компьютерной версии Своей игры.\n```"); } else { await msg.member.roles.remove('511658760389918740'); await msg.member.send("```fix\nУ вас больше нет тематической роли по компьютерной версии Своей игры.\n```"); } } else if (msg.content.match(/^!strategy/i) || msg.content.match(/^!стратегия/i)) { if (!msg.member.roles.has('387352872091910165')) { await msg.member.roles.add(['404810535347945483', '387352872091910165']); await msg.member.send("```fix\nВам была выдана тематическая роль по настольным стратегическим играм.\n```"); } else { await msg.member.roles.remove('387352872091910165'); await msg.member.send("```fix\nУ вас больше нет тематической роли по настольным стратегическим играм.\n```"); } } else if (msg.content.match(/^!workshop/i) || msg.content.match(/^!мододел/i)) { if (!msg.member.roles.has('430272887870586891')) { await msg.member.roles.add(['404810535347945483', '430272887870586891']); await msg.member.send("```fix\nВам была выдана тематическая роль мододела.\n```"); } else { await msg.member.roles.remove('430272887870586891'); await msg.member.send("```fix\nУ вас больше нет тематической роли мододела.\n```"); } } else if (msg.content.match(/^!p/i) || msg.content.match(/^!п/i) || msg.content.match(/^!l/i) || msg.content.match(/^!л/i) || msg.content.match(/^!tabletopsimulator/i) || msg.content.match(/^!тейблтопсимулятор/i) || msg.content.match(/^!tts/i)) { if (!msg.member.roles.has('288997533546708992')) { await msg.member.roles.add(['404810535347945483', '288997533546708992']); await msg.member.send("```fix\nВам была выдана тематическая роль по платформе Tabletop Simulator.\n```"); } else { await msg.member.roles.remove('288997533546708992'); await msg.member.send("```fix\nУ вас больше нет тематической роли по платформе Tabletop Simulator.\n```"); } } else if (msg.content.match(/^!rp$/i) || msg.content.match(/^!roleplay$/i) || msg.content.match(/^!рп$/i) || msg.content.match(/^!ролевка$/i) || msg.content.match(/^!нри$/i) || msg.content.match(/^!nri$/i) || msg.content.match(/^!ролёвка$/i)) { if (!msg.member.roles.has('381076993384382464')) { await msg.member.roles.add(['404810535347945483', '381076993384382464']); await msg.member.send("```fix\nВам была выдана роль раздела по настольным ролевым играм.\n```"); } else { await msg.member.roles.remove('381076993384382464'); await msg.member.send("```fix\nУ вас больше нет роли раздела по настольным ролевым играм.\n```"); } } /* else if (msg.content.match(/^!dj/i)) { if (!msg.member.roles.has('404810535347945483')) { msg.member.addRole('404810535347945483').then((role) => { msg.member.send("```fix\nВам была выдана роль dj, эта роль нужна для управления некоторыми музыкальными ботами.\n```"); return role; }); } else { msg.member.removeRole('404810535347945483').then((role) => { msg.member.send("```fix\nУ вас больше нет роли dj.\n```"); return role; }); } }*/ else if (msg.content.match(/^!нни$/i) || msg.content.match(/^!nni$/i) || msg.content.match(/^!coop$/i) || msg.content.match(/^!кооп$/i) || msg.content.match(/^!othergames$/i) || msg.content.match(/^!og$/i) || msg.content.match(/^!ди$/i) || msg.content.match(/^!другиеигры$/i)) { if (!msg.member.roles.has('363054008564449281')) { await msg.member.roles.add(['404810535347945483', '363054008564449281']); await msg.member.send("```fix\nВам была выдана роль раздела по не настольным играм.\n```"); } else { await msg.member.roles.remove('363054008564449281'); await msg.member.send("```fix\nУ вас больше нет роли раздела по не настольным играм.\n```"); } } else if (msg.content.match(/^!ни$/i) || msg.content.match(/^!ni$/i)) { if (!msg.member.roles.has('500580990805213194')) { await msg.member.roles.add(['404810535347945483', '500580990805213194']); await msg.member.send("```fix\nВам была выдана роль раздела по настольным играм.\n```"); } else { await msg.member.roles.remove('500580990805213194'); await msg.member.send("```fix\nУ вас больше нет роли раздела по настольным играм.\n```"); } } /*else{ if(message.match(/^!rebootxonrbot/) && bot.servers["286198213612929024"].members[userID] != undefined && (bot.servers["286198213612929024"].members[userID].roles.includes("286201408238387201") || bot.servers["286198213612929024"].members[userID].roles.includes("294447183921414145") || bot.servers["286198213612929024"].members[userID].roles.includes("389081897646424064"))){ sendMessages(userID,['```asciidoc\nПерезагрузка. ::  \n```'],0); bot.deleteMessage({channelID: channelID, messageID: event.d["id"]},function(callback) { //console.log(callback); }); setTimeout(() => process.exit(1), 500); } }*/ await client.channels.get("478307990781427720").send("<@" + msg.author.id + ">:" + msg.content.substring(0, 1900)); } } }); process.on('unhandledRejection', function (reason, p) { console.log("Possibly Unhandled Rejection at: Promise ", p, " reason: ", reason); process.exit(); }); process.on('uncaughtException', function (err) { console.log('Caught exception: ', err); process.exit(); }); client.on("disconnect", (error) => { console.log("Disconnected!"); process.exit(); }); client.login('MYTOKEN'); } catch (err) { console.log("new error:" + err); process.exit(); } ```
npm list ``` +-- UNMET PEER DEPENDENCY @discordjs/uws@11.149.1 +-- archiver@3.0.0 | +-- archiver-utils@2.0.0 | | +-- glob@7.1.3 deduped | | +-- graceful-fs@4.1.15 deduped | | +-- lazystream@1.0.0 | | | `-- readable-stream@2.3.6 | | | +-- core-util-is@1.0.2 deduped | | | +-- inherits@2.0.3 deduped | | | +-- isarray@1.0.0 deduped | | | +-- process-nextick-args@2.0.0 deduped | | | +-- safe-buffer@5.1.2 deduped | | | +-- string_decoder@1.1.1 deduped | | | `-- util-deprecate@1.0.2 deduped | | +-- lodash.assign@4.2.0 | | +-- lodash.defaults@4.2.0 | | +-- lodash.difference@4.5.0 | | +-- lodash.flatten@4.4.0 | | +-- lodash.isplainobject@4.0.6 | | +-- lodash.toarray@4.4.0 | | +-- lodash.union@4.6.0 | | +-- normalize-path@3.0.0 | | `-- readable-stream@2.3.6 | | +-- core-util-is@1.0.2 deduped | | +-- inherits@2.0.3 deduped | | +-- isarray@1.0.0 deduped | | +-- process-nextick-args@2.0.0 deduped | | +-- safe-buffer@5.1.2 deduped | | +-- string_decoder@1.1.1 deduped | | `-- util-deprecate@1.0.2 deduped | +-- async@2.6.1 | | `-- lodash@4.17.11 deduped | +-- buffer-crc32@0.2.13 | +-- glob@7.1.3 | | +-- fs.realpath@1.0.0 | | +-- inflight@1.0.6 | | | +-- once@1.4.0 deduped | | | `-- wrappy@1.0.2 | | +-- inherits@2.0.3 deduped | | +-- minimatch@3.0.4 | | | `-- brace-expansion@1.1.11 | | | +-- balanced-match@1.0.0 | | | `-- concat-map@0.0.1 | | +-- once@1.4.0 | | | `-- wrappy@1.0.2 deduped | | `-- path-is-absolute@1.0.1 | +-- readable-stream@2.3.6 | | +-- core-util-is@1.0.2 | | +-- inherits@2.0.3 | | +-- isarray@1.0.0 | | +-- process-nextick-args@2.0.0 | | +-- safe-buffer@5.1.2 deduped | | +-- string_decoder@1.1.1 | | | `-- safe-buffer@5.1.2 deduped | | `-- util-deprecate@1.0.2 | +-- tar-stream@1.6.2 | | +-- bl@1.2.2 | | | +-- readable-stream@2.3.6 | | | | +-- core-util-is@1.0.2 deduped | | | | +-- inherits@2.0.3 deduped | | | | +-- isarray@1.0.0 deduped | | | | +-- process-nextick-args@2.0.0 deduped | | | | +-- safe-buffer@5.1.2 deduped | | | | +-- string_decoder@1.1.1 deduped | | | | `-- util-deprecate@1.0.2 deduped | | | `-- safe-buffer@5.1.2 deduped | | +-- buffer-alloc@1.2.0 | | | +-- buffer-alloc-unsafe@1.1.0 | | | `-- buffer-fill@1.0.0 | | +-- end-of-stream@1.4.1 | | | `-- once@1.4.0 deduped | | +-- fs-constants@1.0.0 | | +-- readable-stream@2.3.6 | | | +-- core-util-is@1.0.2 deduped | | | +-- inherits@2.0.3 deduped | | | +-- isarray@1.0.0 deduped | | | +-- process-nextick-args@2.0.0 deduped | | | +-- safe-buffer@5.1.2 deduped | | | +-- string_decoder@1.1.1 deduped | | | `-- util-deprecate@1.0.2 deduped | | +-- to-buffer@1.1.1 | | `-- xtend@4.0.1 | `-- zip-stream@2.0.1 | +-- archiver-utils@2.0.0 deduped | +-- compress-commons@1.2.2 | | +-- buffer-crc32@0.2.13 deduped | | +-- crc32-stream@2.0.0 | | | +-- crc@3.8.0 | | | | `-- buffer@5.2.1 | | | | +-- base64-js@1.3.0 | | | | `-- ieee754@1.1.12 | | | `-- readable-stream@2.3.6 | | | +-- core-util-is@1.0.2 deduped | | | +-- inherits@2.0.3 deduped | | | +-- isarray@1.0.0 deduped | | | +-- process-nextick-args@2.0.0 deduped | | | +-- safe-buffer@5.1.2 deduped | | | +-- string_decoder@1.1.1 deduped | | | `-- util-deprecate@1.0.2 deduped | | +-- normalize-path@2.1.1 | | | `-- remove-trailing-separator@1.1.0 | | `-- readable-stream@2.3.6 | | +-- core-util-is@1.0.2 deduped | | +-- inherits@2.0.3 deduped | | +-- isarray@1.0.0 deduped | | +-- process-nextick-args@2.0.0 deduped | | +-- safe-buffer@5.1.2 deduped | | +-- string_decoder@1.1.1 deduped | | `-- util-deprecate@1.0.2 deduped | `-- readable-stream@2.3.6 | +-- core-util-is@1.0.2 deduped | +-- inherits@2.0.3 deduped | +-- isarray@1.0.0 deduped | +-- process-nextick-args@2.0.0 deduped | +-- safe-buffer@5.1.2 deduped | +-- string_decoder@1.1.1 deduped | `-- util-deprecate@1.0.2 deduped +-- bbcode-to-markdown@1.0.1 | +-- bbcodejs@0.0.4 | +-- extend@3.0.2 | +-- html-entities@1.2.1 | +-- html-md.js@1.0.2 | | +-- commander@2.0.0 | | +-- fs-extra@0.7.1 | | | +-- jsonfile@1.1.1 | | | +-- mkdirp@0.3.5 | | | +-- ncp@0.4.2 | | | `-- rimraf@2.2.8 | | `-- jsdom-nogyp@0.8.3 deduped | +-- jsdom-nogyp@0.8.3 | | +-- cssom@0.2.5 | | +-- cssstyle@0.2.37 | | | `-- cssom@0.3.4 | | +-- htmlparser2@3.10.0 deduped | | +-- nwmatcher@1.3.9 | | +-- request@2.88.0 deduped | | `-- xmlhttprequest@1.8.0 | `-- to-markdown@3.1.1 | +-- collapse-whitespace@1.1.2 | | +-- block-elements@1.2.0 | | `-- void-elements@2.0.1 | `-- jsdom@9.12.0 | +-- abab@1.0.4 | +-- acorn@4.0.13 | +-- acorn-globals@3.1.0 | | `-- acorn@4.0.13 deduped | +-- array-equal@1.0.0 deduped | +-- content-type-parser@1.0.2 | +-- cssom@0.3.4 deduped | +-- cssstyle@0.2.37 | | `-- cssom@0.3.4 deduped | +-- escodegen@1.11.0 deduped | +-- html-encoding-sniffer@1.0.2 deduped | +-- nwmatcher@1.3.9 deduped | +-- parse5@1.5.1 | +-- request@2.88.0 deduped | +-- sax@1.2.4 deduped | +-- symbol-tree@3.2.2 deduped | +-- tough-cookie@2.4.3 deduped | +-- webidl-conversions@4.0.2 deduped | +-- whatwg-encoding@1.0.5 deduped | +-- whatwg-url@4.8.0 | | +-- tr46@0.0.3 | | `-- webidl-conversions@3.0.1 | `-- xml-name-validator@2.0.1 +-- bson@3.0.2 +-- bson-json-transform@1.0.3 +-- UNMET PEER DEPENDENCY bufferutil@^4.0.0 +-- cheerio@1.0.0-rc.2 | +-- css-select@1.2.0 | | +-- boolbase@1.0.0 | | +-- css-what@2.1.2 | | +-- domutils@1.5.1 | | | +-- dom-serializer@0.1.0 deduped | | | `-- domelementtype@1.2.1 | | `-- nth-check@1.0.2 | | `-- boolbase@1.0.0 deduped | +-- dom-serializer@0.1.0 | | +-- domelementtype@1.1.3 | | `-- entities@1.1.2 deduped | +-- entities@1.1.2 | +-- htmlparser2@3.10.0 | | +-- domelementtype@1.3.0 | | +-- domhandler@2.4.2 | | | `-- domelementtype@1.2.1 deduped | | +-- domutils@1.5.1 deduped | | +-- entities@1.1.2 deduped | | +-- inherits@2.0.3 deduped | | `-- readable-stream@3.0.6 | | +-- inherits@2.0.3 deduped | | +-- string_decoder@1.1.1 deduped | | `-- util-deprecate@1.0.2 deduped | +-- lodash@4.17.11 | `-- parse5@3.0.3 | `-- @types/node@10.12.2 +-- crypto@1.0.1 +-- crypto-shuffle@1.0.1 | `-- get-random-values@1.2.0 | `-- global@4.3.2 | +-- min-document@2.19.0 | | `-- dom-walk@0.1.1 | `-- process@0.5.2 +-- discord.js@12.0.0-dev (git+https://github.com/discordjs/discord.js.git#3dff5058f0beae01cec0abe27e3a43c8fd7c60ce) | +-- form-data@2.3.3 | | +-- asynckit@0.4.0 | | +-- combined-stream@1.0.7 deduped | | `-- mime-types@2.1.21 deduped | +-- node-fetch@2.3.0 | +-- pako@1.0.8 | +-- prism-media@0.3.1 (github:amishshah/prism-media#1e336c9a20dd0928ef3bdc2075ab58d1521fb323) | +-- setimmediate@1.0.5 | +-- tweetnacl@1.0.1 | `-- ws@6.1.3 deduped +-- erlpack@0.1.0 (github:discordapp/erlpack#674ebfd3439ba4b7ce616709821d27630f7cdc61) | +-- bindings@1.3.1 | `-- nan@2.11.1 +-- eyes@0.1.8 +-- filenamify@2.1.0 | +-- filename-reserved-regex@2.0.0 | +-- strip-outer@1.0.1 | | `-- escape-string-regexp@1.0.5 | `-- trim-repeated@1.0.0 | `-- escape-string-regexp@1.0.5 deduped +-- fs@0.0.1-security +-- https@1.0.0 +-- image-type@3.0.0 | `-- file-type@4.4.0 +-- js-sha256@0.9.0 +-- jsdom@13.2.0 | +-- abab@2.0.0 | +-- acorn@6.0.5 | +-- acorn-globals@4.3.0 | | +-- acorn@6.0.5 deduped | | `-- acorn-walk@6.1.1 | +-- array-equal@1.0.0 | +-- cssom@0.3.4 | +-- cssstyle@1.1.1 | | `-- cssom@0.3.4 deduped | +-- data-urls@1.1.0 | | +-- abab@2.0.0 deduped | | +-- whatwg-mimetype@2.3.0 deduped | | `-- whatwg-url@7.0.0 deduped | +-- domexception@1.0.1 | | `-- webidl-conversions@4.0.2 deduped | +-- escodegen@1.11.0 | | +-- esprima@3.1.3 | | +-- estraverse@4.2.0 | | +-- esutils@2.0.2 | | +-- optionator@0.8.2 | | | +-- deep-is@0.1.3 | | | +-- fast-levenshtein@2.0.6 | | | +-- levn@0.3.0 | | | | +-- prelude-ls@1.1.2 deduped | | | | `-- type-check@0.3.2 deduped | | | +-- prelude-ls@1.1.2 | | | +-- type-check@0.3.2 | | | | `-- prelude-ls@1.1.2 deduped | | | `-- wordwrap@1.0.0 | | `-- source-map@0.6.1 | +-- html-encoding-sniffer@1.0.2 | | `-- whatwg-encoding@1.0.5 deduped | +-- nwsapi@2.0.9 | +-- parse5@5.1.0 | +-- pn@1.1.0 | +-- request@2.88.0 deduped | +-- request-promise-native@1.0.5 | | +-- request-promise-core@1.1.1 deduped | | +-- stealthy-require@1.1.1 deduped | | `-- tough-cookie@2.4.3 deduped | +-- saxes@3.1.6 | | `-- xmlchars@1.3.1 | +-- symbol-tree@3.2.2 | +-- tough-cookie@2.5.0 | | +-- psl@1.1.29 | | `-- punycode@2.1.1 | +-- w3c-hr-time@1.0.1 | | `-- browser-process-hrtime@0.1.3 | +-- w3c-xmlserializer@1.0.1 | | +-- domexception@1.0.1 deduped | | +-- webidl-conversions@4.0.2 deduped | | `-- xml-name-validator@3.0.0 deduped | +-- webidl-conversions@4.0.2 | +-- whatwg-encoding@1.0.5 | | `-- iconv-lite@0.4.24 deduped | +-- whatwg-mimetype@2.3.0 | +-- whatwg-url@7.0.0 | | +-- lodash.sortby@4.7.0 | | +-- tr46@1.0.1 | | | `-- punycode@2.1.1 deduped | | `-- webidl-conversions@4.0.2 deduped | +-- ws@6.1.3 deduped | `-- xml-name-validator@3.0.0 +-- UNMET PEER DEPENDENCY libsodium-wrappers@^0.7.3 +-- moment@2.24.0 +-- moment-timezone@0.5.23 | `-- moment@2.24.0 deduped +-- mysql@2.16.0 | +-- bignumber.js@4.1.0 | +-- readable-stream@2.3.6 | | +-- core-util-is@1.0.2 deduped | | +-- inherits@2.0.3 deduped | | +-- isarray@1.0.0 deduped | | +-- process-nextick-args@2.0.0 deduped | | +-- safe-buffer@5.1.2 deduped | | +-- string_decoder@1.1.1 deduped | | `-- util-deprecate@1.0.2 deduped | +-- safe-buffer@5.1.2 | `-- sqlstring@2.3.1 +-- mysql2@1.6.4 | +-- denque@1.3.0 | +-- generate-function@2.3.1 | | `-- is-property@1.0.2 | +-- iconv-lite@0.4.24 | | `-- safer-buffer@2.1.2 | +-- long@4.0.0 | +-- lru-cache@4.1.3 | | +-- pseudomap@1.0.2 | | `-- yallist@2.1.2 | +-- named-placeholders@1.1.1 | | `-- lru-cache@2.5.0 | +-- seq-queue@0.0.5 | `-- sqlstring@2.3.1 deduped +-- node-native-zip@1.1.0 +-- node-static@0.7.11 | +-- colors@1.3.2 | +-- mime@1.6.0 | `-- optimist@0.6.1 | +-- minimist@0.0.10 | `-- wordwrap@0.0.3 +-- path@0.12.7 | +-- process@0.11.10 | `-- util@0.10.4 | `-- inherits@2.0.3 deduped +-- random-number-csprng@1.0.2 | +-- bluebird@3.5.2 | `-- create-error@0.3.1 +-- read-chunk@3.0.0 | +-- pify@4.0.1 | `-- with-open-file@0.1.4 | +-- p-finally@1.0.0 | +-- p-try@2.0.0 | `-- pify@3.0.0 +-- request@2.88.0 | +-- aws-sign2@0.7.0 | +-- aws4@1.8.0 | +-- caseless@0.12.0 | +-- combined-stream@1.0.7 | | `-- delayed-stream@1.0.0 | +-- extend@3.0.2 deduped | +-- forever-agent@0.6.1 | +-- form-data@2.3.3 deduped | +-- har-validator@5.1.0 | | +-- ajv@5.5.2 | | | +-- co@4.6.0 | | | +-- fast-deep-equal@1.1.0 | | | +-- fast-json-stable-stringify@2.0.0 | | | `-- json-schema-traverse@0.3.1 | | `-- har-schema@2.0.0 | +-- http-signature@1.2.0 | | +-- assert-plus@1.0.0 | | +-- jsprim@1.4.1 | | | +-- assert-plus@1.0.0 deduped | | | +-- extsprintf@1.3.0 | | | +-- json-schema@0.2.3 | | | `-- verror@1.10.0 | | | +-- assert-plus@1.0.0 deduped | | | +-- core-util-is@1.0.2 deduped | | | `-- extsprintf@1.3.0 deduped | | `-- sshpk@1.15.2 | | +-- asn1@0.2.4 | | | `-- safer-buffer@2.1.2 deduped | | +-- assert-plus@1.0.0 deduped | | +-- bcrypt-pbkdf@1.0.2 | | | `-- tweetnacl@0.14.5 | | +-- dashdash@1.14.1 | | | `-- assert-plus@1.0.0 deduped | | +-- ecc-jsbn@0.1.2 | | | +-- jsbn@0.1.1 deduped | | | `-- safer-buffer@2.1.2 deduped | | +-- getpass@0.1.7 | | | `-- assert-plus@1.0.0 deduped | | +-- jsbn@0.1.1 | | +-- safer-buffer@2.1.2 deduped | | `-- tweetnacl@0.14.5 | +-- is-typedarray@1.0.0 | +-- isstream@0.1.2 | +-- json-stringify-safe@5.0.1 | +-- mime-types@2.1.21 | | `-- mime-db@1.37.0 | +-- oauth-sign@0.9.0 | +-- performance-now@2.1.0 | +-- qs@6.5.2 | +-- safe-buffer@5.1.2 deduped | +-- tough-cookie@2.4.3 | | +-- psl@1.1.29 deduped | | `-- punycode@1.4.1 | +-- tunnel-agent@0.6.0 | | `-- safe-buffer@5.1.2 deduped | `-- uuid@3.3.2 +-- request-promise@4.2.2 | +-- bluebird@3.5.2 deduped | +-- request-promise-core@1.1.1 | | `-- lodash@4.17.11 deduped | +-- stealthy-require@1.1.1 | `-- tough-cookie@2.4.3 deduped +-- rimraf@2.6.3 | `-- glob@7.1.3 deduped +-- rmfr@2.0.0 | +-- assert-valid-glob-opts@1.0.0 | | +-- glob-option-error@1.0.0 | | `-- validate-glob-opts@1.0.2 | | +-- array-to-sentence@1.1.0 | | +-- indexed-filter@1.0.3 | | | `-- append-type@1.0.1 | | +-- inspect-with-kind@1.0.5 deduped | | `-- is-plain-obj@1.1.0 | +-- glob@7.1.3 deduped | +-- graceful-fs@4.1.15 | +-- inspect-with-kind@1.0.5 | | `-- kind-of@6.0.2 | `-- rimraf@2.6.3 deduped +-- sharp@0.21.3 | +-- bindings@1.3.1 deduped | +-- color@3.1.0 | | +-- color-convert@1.9.3 | | | `-- color-name@1.1.3 | | `-- color-string@1.5.3 | | +-- color-name@1.1.3 deduped | | `-- simple-swizzle@0.2.2 | | `-- is-arrayish@0.3.2 | +-- detect-libc@1.0.3 | +-- fs-copy-file-sync@1.1.1 | +-- nan@2.12.1 | +-- npmlog@4.1.2 | | +-- are-we-there-yet@1.1.5 | | | +-- delegates@1.0.0 | | | `-- readable-stream@2.3.6 | | | +-- core-util-is@1.0.2 deduped | | | +-- inherits@2.0.3 deduped | | | +-- isarray@1.0.0 deduped | | | +-- process-nextick-args@2.0.0 deduped | | | +-- safe-buffer@5.1.2 deduped | | | +-- string_decoder@1.1.1 deduped | | | `-- util-deprecate@1.0.2 deduped | | +-- console-control-strings@1.1.0 | | +-- gauge@2.7.4 | | | +-- aproba@1.2.0 | | | +-- console-control-strings@1.1.0 deduped | | | +-- has-unicode@2.0.1 | | | +-- object-assign@4.1.1 | | | +-- signal-exit@3.0.2 | | | +-- string-width@1.0.2 | | | | +-- code-point-at@1.1.0 | | | | +-- is-fullwidth-code-point@1.0.0 | | | | | `-- number-is-nan@1.0.1 | | | | `-- strip-ansi@3.0.1 deduped | | | +-- strip-ansi@3.0.1 | | | | `-- ansi-regex@2.1.1 | | | `-- wide-align@1.1.3 | | | `-- string-width@1.0.2 deduped | | `-- set-blocking@2.0.0 | +-- prebuild-install@5.2.2 | | +-- detect-libc@1.0.3 deduped | | +-- expand-template@2.0.3 | | +-- github-from-package@0.0.0 | | +-- minimist@1.2.0 | | +-- mkdirp@0.5.1 | | | `-- minimist@0.0.8 | | +-- napi-build-utils@1.0.1 | | +-- node-abi@2.5.1 | | | `-- semver@5.6.0 deduped | | +-- noop-logger@0.1.1 | | +-- npmlog@4.1.2 deduped | | +-- os-homedir@1.0.2 | | +-- pump@2.0.1 | | | +-- end-of-stream@1.4.1 deduped | | | `-- once@1.4.0 deduped | | +-- rc@1.2.8 | | | +-- deep-extend@0.6.0 | | | +-- ini@1.3.5 | | | +-- minimist@1.2.0 | | | `-- strip-json-comments@2.0.1 | | +-- simple-get@2.8.1 | | | +-- decompress-response@3.3.0 deduped | | | +-- once@1.4.0 deduped | | | `-- simple-concat@1.0.0 deduped | | +-- tar-fs@1.16.3 | | | +-- chownr@1.1.1 deduped | | | +-- mkdirp@0.5.1 | | | | `-- minimist@0.0.8 | | | +-- pump@1.0.3 | | | | +-- end-of-stream@1.4.1 deduped | | | | `-- once@1.4.0 deduped | | | `-- tar-stream@1.6.2 deduped | | +-- tunnel-agent@0.6.0 deduped | | `-- which-pm-runs@1.0.0 | +-- semver@5.6.0 | +-- simple-get@3.0.3 | | +-- decompress-response@3.3.0 | | | `-- mimic-response@1.0.1 | | +-- once@1.4.0 deduped | | `-- simple-concat@1.0.0 | +-- tar@4.4.8 | | +-- chownr@1.1.1 | | +-- fs-minipass@1.2.5 | | | `-- minipass@2.3.5 deduped | | +-- minipass@2.3.5 | | | +-- safe-buffer@5.1.2 deduped | | | `-- yallist@3.0.3 | | +-- minizlib@1.2.1 | | | `-- minipass@2.3.5 deduped | | +-- mkdirp@0.5.1 | | | `-- minimist@0.0.8 | | +-- safe-buffer@5.1.2 deduped | | `-- yallist@3.0.3 | `-- tunnel-agent@0.6.0 deduped +-- sodium@2.0.3 | `-- nan@2.11.1 deduped +-- steam-web@0.7.0 | `-- qs@6.5.2 deduped +-- steamid@1.1.0 | `-- cuint@0.2.2 +-- underscore@1.9.1 +-- url-exists-promise@1.0.2 +-- ws@6.1.3 | `-- async-limiter@1.0.0 +-- xml2js@0.4.19 | +-- sax@1.2.4 | `-- xmlbuilder@9.0.7 `-- zlib-sync@0.1.4 `-- nan@2.11.1 deduped npm ERR! peer dep missing: @discordjs/uws@^10.149.0, required by discord.js@12.0.0-dev npm ERR! peer dep missing: bufferutil@^4.0.0, required by discord.js@12.0.0-dev npm ERR! peer dep missing: libsodium-wrappers@^0.7.3, required by discord.js@12.0.0-dev ```

Node: v8.15.0

Distributor ID: Debian
Description:    Debian GNU/Linux 9.7 (stretch)
Release:        9.7
Codename:       stretch
Linux 1e9778c9 2.6.32-042stab134.8 #1 SMP Fri Dec 7 17:16:09 MSK 2018 x86_64 GNU/Linux
kyranet commented 5 years ago

@xonrsoftware relax, this issue is confirmed (though the labels say otherwise, somebody has to change them).

There are two PRs that fix this, with similar implementations: https://github.com/discordjs/discord.js/pull/2976 and https://github.com/discordjs/discord.js/pull/2996. If this issue happens to you many times, please consider using any of both PRs!

xonrsoftware commented 5 years ago

@xonrsoftware relax, this issue is confirmed (though the labels say otherwise, somebody has to change them).

There are two PRs that fix this, with similar implementations: #2976 and #2996. If this issue happens to you many times, please consider using any of both PRs!

2996 Not fixing this problem. Will try #2976 now.

ghost commented 5 years ago

Just to provide some additional feedback, #2996 seems to have fixed the issue for me. My bot was disconnecting once, sometimes twice a day before this, and after applying #2996 I haven't disconnected in about a week. Will continue testing. I also didn't merge with master, I just checked out the PR, so maybe that's why I'm having better luck with it?

xonrsoftware commented 5 years ago

Seems like #2976 (14b771b05599535970262a3e673a74927df55264) fixed this for me.

amishshah commented 5 years ago

Fixed in https://github.com/discordjs/discord.js/commit/793341dbb401f2956d60fd6b9f94a611cf539126

xonrsoftware commented 5 years ago

Not fixed. Tested on 89e27e507144dd3c32d644e0f298207eb538ff65. Experiencing same issues. @vladfrangu Node: v11.13.0 pm2: 3.4.1 npm: 6.7.0

Debug log after silent disconnect: ```log ..more messages about heartbeat acknowledged... [WS => Shard 0] Heartbeat acknowledged, latency of 107ms. [WS => Shard 0] Sending a heartbeat. [WS => Shard 0] Didn't receive a heartbeat ack last time, assuming zombie conenction. Destroying and reconnecting. [WS => Shard 0] Clearing the heartbeat interval. [WS => Shard 0] WebSocket was closed. Event Code: 4009 Clean: undefined Reason: No reason received [WS => Shard 0] Session ID is present, attempting an immediate reconnect... [WS => Shard 0] Trying to connect to wss://gateway.discord.gg/, version 6 [WS => Shard 0] Setting a HELLO timeout for 20s. [WS => Shard 0] Did not receive HELLO in time. Destroying and connecting again. [WS => Shard 0] Clearing the HELLO timeout. [WS => Shard 0] Tried to send packet {"op":3,"d":{"afk":false,"since":null,"status":"invisible","game":null}} but no WebSocket is available! [WS => Shard 0] Tried to send packet {"op":3,"d":{"afk":false,"since":null,"status":"invisible","game":null}} but no WebSocket is available! [WS => Shard 0] Tried to send packet {"op":3,"d":{"afk":false,"since":null,"status":"invisible","game":null}} but no WebSocket is available! [WS => Shard 0] Tried to send packet {"op":3,"d":{"afk":false,"since":null,"status":"invisible","game":null}} but no WebSocket is available! ```

Ready event contains:

client.on('ready', async () => {
...
 setInterval(function () {
            client.user.setStatus('invisible');
        }, 600000);
...
});
Ensjam commented 5 years ago

Same issue

Deivu commented 5 years ago

Try using with uws, in past that solved this issue for me ^

xonrsoftware commented 5 years ago

Try using with uws, in past that solved this issue for me ^

I using it already.

Deivu commented 5 years ago

use a commit before internal sharding merge in master then use it with uws ^ if the latest master isnt working right for you

xonrsoftware commented 5 years ago

use a commit before internal sharding merge in master then use it with uws ^ if the latest master isnt working right for you

This bug is present since 11.4 as i remember. (When i start using d.js, may be in early versions too) Because of it and some other stuff i upgraded it to master. Still here.