diff --git a/CHANGELOG.md b/CHANGELOG.md index 58768a5..37e67cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v2.4.1-v2.4.3 +* Fix errors on first run after upgrading to v2.2.0 +* Various other fixes + ## v2.4.0 * Add thread suspending. A modmail thread can now be suspended with `!suspend`. Suspended threads will function as closed until unsuspended with `!unsuspend`. diff --git a/src/main.js b/src/main.js index d46dada..6cfc5ba 100644 --- a/src/main.js +++ b/src/main.js @@ -188,18 +188,16 @@ async function applyScheduledCloses() { } } -async function closeLoop() { +async function scheduledCloseLoop() { try { await applyScheduledCloses(); } catch (e) { console.error(e); } - setTimeout(closeLoop, 2000); + setTimeout(scheduledCloseLoop, 2000); } -closeLoop(); - // Auto-close threads if their channel is deleted bot.on('channelDelete', async (channel) => { if (! (channel instanceof Eris.TextChannel)) return; @@ -442,9 +440,13 @@ module.exports = { await greeting(bot); await webserver(bot); + // Connect to Discord console.log('Connecting to Discord...'); await bot.connect(); + // Start scheduled close loop + scheduledCloseLoop(); + console.log('Done! Now listening to DMs.'); } };