forked from Galactic/modmail
rapid bugfix
This commit is contained in:
parent
64095adc1a
commit
ed4e4b132c
@ -64,7 +64,7 @@ class ModmailClient extends Client {
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', (reason, prom) => {
|
||||
this.logger.error(`Unhandled promise rejection at: ${prom}\nReason: ${reason}`);
|
||||
this.logger.error(`Unhandled promise rejection at: ${inspect(prom)}\nReason: ${reason}`);
|
||||
});
|
||||
|
||||
this._ready = true;
|
||||
|
@ -92,9 +92,11 @@ class JsonCache extends CacheHandler {
|
||||
|
||||
}
|
||||
|
||||
verifyQueue () {
|
||||
async verifyQueue () {
|
||||
|
||||
this.client.logger.info(`Verifying modmail queue.`);
|
||||
this.queue.forEach(async entry => {
|
||||
|
||||
for (const entry of this.queue) {
|
||||
const path = `./modmail_cache/${entry}.json`;
|
||||
if (fs.existsSync(path)) return;
|
||||
|
||||
@ -105,11 +107,16 @@ class JsonCache extends CacheHandler {
|
||||
messages = messages.filter(msg => msg.author.id !== this.client.user.id).sort((a, b) => a.createdTimestamp - b.createdTimestamp);
|
||||
|
||||
const history = await this.loadModmailHistory(entry);
|
||||
for (const { author, content, createdTimestamp, attachments } of messages) history.push({ attachments: attachments.map(att => att.url), author: author.id, content, timestamp: createdTimestamp });
|
||||
for (const { author, content, createdTimestamp, attachments } of messages.values()) {
|
||||
history.push({ attachments: attachments.map(att => att.url), author: author.id, content, timestamp: createdTimestamp });
|
||||
}
|
||||
this.updatedThreads.push(entry);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
this.client.logger.info(`Queue verified.`);
|
||||
this.saveModmailHistory();
|
||||
|
||||
}
|
||||
|
||||
get json () {
|
||||
|
Loading…
Reference in New Issue
Block a user