diff --git a/src/bot.js b/src/bot.js index 628c8d2..d65134a 100644 --- a/src/bot.js +++ b/src/bot.js @@ -27,11 +27,15 @@ const bot = new Eris.Client(config.token, { }, }); +// Eris allegedly handles these internally, so we can ignore them +const SAFE_TO_IGNORE_ERROR_CODES = [ + 1001, // "CloudFlare WebSocket proxy restarting" + 1006, // "Connection reset by peer" + "ECONNRESET", // Pretty much the same as above +]; + bot.on("error", err => { - if (err.code === 1006 || err.code === "ECONNRESET") { - // 1006 = "Connection reset by peer" - // ECONNRESET is similar - // Eris allegedly handles these internally, so we can ignore them + if (SAFE_TO_IGNORE_ERROR_CODES.includes(err.code)) { return; }