idk if this gonna fix it but prob no

This commit is contained in:
ChomeNS 2022-10-22 12:58:07 +07:00
parent 16b9ce3704
commit c601677e42

View file

@ -220,6 +220,37 @@ function main() {
}
}, 100);
bot.once('end', (reason, event) => {
console.log(`Disconnected (${event} event): ${util.inspect(reason)}`);
channel.send(`Disconnected (${event} event): \`${util.inspect(reason)}\``);
const timeout = config.reconnectTimeout;
// try {
// if (reason.text) {
// if (reason.text === 'Wait 5 seconds before connecting, thanks! :)') timeout = 1000 * 6;
// if (reason.text === 'You are logging in too fast, try again later.') timeout = 1000 * 6;
// }
// } catch (e) {
// console.log(e.message);
// }
try {
clearInterval(notonline);
clearInterval(discordQueue);
clearInterval(chatQueue);
clearInterval(consoleQueueInterval);
} catch (e) {
return;
}
setTimeout(() => {
bot.end();
botThings();
main();
}, timeout);
});
console.log(`Connecting to: ${bot.options.host}:${bot.options.port}...`);
// fs.appendFileSync('./logs.txt', `\r\Connecting to: ${bot.options.host}:${bot.options.port}...\r\n`);
channel.send(`Connecting to: \`${bot.options.host}:${bot.options.port}\`...`);
@ -372,37 +403,6 @@ function main() {
channel.send('uncaught ```\n' + util.inspect(error) + '\n```');
bot.emit('end', 'uncaughtException', 'process: uncaughtException');
});
bot.once('end', (reason, event) => {
console.log(`Disconnected (${event} event): ${util.inspect(reason)}`);
channel.send(`Disconnected (${event} event): \`${util.inspect(reason)}\``);
const timeout = config.reconnectTimeout;
// try {
// if (reason.text) {
// if (reason.text === 'Wait 5 seconds before connecting, thanks! :)') timeout = 1000 * 6;
// if (reason.text === 'You are logging in too fast, try again later.') timeout = 1000 * 6;
// }
// } catch (e) {
// console.log(e.message);
// }
try {
clearInterval(notonline);
clearInterval(discordQueue);
clearInterval(chatQueue);
clearInterval(consoleQueueInterval);
} catch (e) {
return;
}
setTimeout(() => {
bot.end();
botThings();
main();
}, timeout);
});
}
dcclient.on('ready', async () => {