diff --git a/structure/Client.js b/structure/Client.js index 3751d2b..4e4cdf6 100644 --- a/structure/Client.js +++ b/structure/Client.js @@ -59,6 +59,7 @@ class ModmailClient extends Client { process.on('exit', this.saveCache.bind(this)); process.on('SIGINT', () => { this.saveCache.bind(this); + this.modmail.saveHistory(); // eslint-disable-next-line no-process-exit process.exit(); }); diff --git a/structure/Modmail.js b/structure/Modmail.js index fddd3ee..ce2ae88 100644 --- a/structure/Modmail.js +++ b/structure/Modmail.js @@ -7,9 +7,12 @@ class Modmail { this.client = client; this.mainServer = null; this.bansServer = null; + this.categories = client._options.modmailCategory; this.graveyardInactive = client._options.graveyardInactive; this.readInactive = client._options.readInactive; + this.channelSweepInterval = client._options.channelSweepInterval; + this.saveInterval = client._options.saveInterval; this.updatedThreads = []; this.mmcache = {}; @@ -35,8 +38,8 @@ class Modmail { this.replies = this.loadReplies(); // Sweep graveyard every 30 min and move stale channels to graveyard - this.sweeper = setInterval(this.sweepChannels.bind(this), 5 * 60 * 1000); - this.saver = setInterval(this.saveHistory.bind(this), 30 * 1000); + this.sweeper = setInterval(this.sweepChannels.bind(this), this.channelSweepInterval * 60 * 1000); + this.saver = setInterval(this.saveHistory.bind(this), this.saveInterval * 60 * 1000); let logStr = `Started modmail handler for ${this.mainServer.name}`; if (this.bansServer) logStr += ` with ${this.bansServer.name} for ban appeals`;