Open githubuser1102 opened 6 years ago
Are you using the gateway v6 community fork? (Woor/discord.io)
Yes, installed a few days ago.
I've never heard of this happening before. Maybe join the support server and ask there? https://discord.gg/0MvHMfHcTKVVmIGP
Ok thanks
For future readers, the solution was to add a disconnect listener.
bot.on("disconnect", () => {
bot.connect();
});
Apparently the solution was not to add a disconnect listener. Sorry future readers, still an issue!
As a troubleshooting step, try changing your disconnect handler to this. It will print an error code and an error message to the console when it disconnects.
bot.on('disconnect', function(errMsg, code) {
console.log(`Disconnected from Discord. Error Code ${code}. Message ${errMsg}.`
bot.connect();
}
Hmm, I tried that but nothing gets outputted into the console. Wondering if it's not picking it up as a disconnect.
Also your code was missing a (
and a );
, so I think I fixed that with
bot.on('disconnect', function(errMsg, code) {
console.log(`Disconnected from Discord. Error Code ${code}. Message ${errMsg}.`);
bot.connect();
});
Never mind, lucky try.
Sometimes when I do
node bot.js
it waits at least 5-7 seconds then starts and everything works fine. But sometimes I do it and it starts really fast, and it's detecting stuff in Command Prompt, but is outputting nothing to Discord. This includes the bot's presence (says online but not playing anything) and sending messages. When it does this when I'm running manually to test, I justCTRL+C
then up arrow then enter to re-run. But on Heroku, where it restarts every once in a while, I can't control whether it does it correctly or not. Any help is appreciated.I am on Windows 7 running bot normally from Command Prompt