more improvements

This commit is contained in:
Erik 2021-06-19 22:31:51 +03:00
parent 248a6a0f71
commit 557bc23248
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16
2 changed files with 6 additions and 2 deletions

View File

@ -59,6 +59,7 @@ class ModmailClient extends Client {
process.on('exit', this.saveCache.bind(this)); process.on('exit', this.saveCache.bind(this));
process.on('SIGINT', () => { process.on('SIGINT', () => {
this.saveCache.bind(this); this.saveCache.bind(this);
this.modmail.saveHistory();
// eslint-disable-next-line no-process-exit // eslint-disable-next-line no-process-exit
process.exit(); process.exit();
}); });

View File

@ -7,9 +7,12 @@ class Modmail {
this.client = client; this.client = client;
this.mainServer = null; this.mainServer = null;
this.bansServer = null; this.bansServer = null;
this.categories = client._options.modmailCategory; this.categories = client._options.modmailCategory;
this.graveyardInactive = client._options.graveyardInactive; this.graveyardInactive = client._options.graveyardInactive;
this.readInactive = client._options.readInactive; this.readInactive = client._options.readInactive;
this.channelSweepInterval = client._options.channelSweepInterval;
this.saveInterval = client._options.saveInterval;
this.updatedThreads = []; this.updatedThreads = [];
this.mmcache = {}; this.mmcache = {};
@ -35,8 +38,8 @@ class Modmail {
this.replies = this.loadReplies(); this.replies = this.loadReplies();
// Sweep graveyard every 30 min and move stale channels to graveyard // Sweep graveyard every 30 min and move stale channels to graveyard
this.sweeper = setInterval(this.sweepChannels.bind(this), 5 * 60 * 1000); this.sweeper = setInterval(this.sweepChannels.bind(this), this.channelSweepInterval * 60 * 1000);
this.saver = setInterval(this.saveHistory.bind(this), 30 * 1000); this.saver = setInterval(this.saveHistory.bind(this), this.saveInterval * 60 * 1000);
let logStr = `Started modmail handler for ${this.mainServer.name}`; let logStr = `Started modmail handler for ${this.mainServer.name}`;
if (this.bansServer) logStr += ` with ${this.bansServer.name} for ban appeals`; if (this.bansServer) logStr += ` with ${this.bansServer.name} for ban appeals`;