diff --git a/structure/Modmail.js b/structure/Modmail.js index 0f2b8a5..c55ad2b 100644 --- a/structure/Modmail.js +++ b/structure/Modmail.js @@ -264,23 +264,6 @@ class Modmail { } - async overflow() { // Overflows new modmail category into read - const channels = this.newMail.children.sort((a, b) => { - if (!a.lastMessage) return -1; - if (!b.lastMessage) return 1; - return a.lastMessage.createdTimestamp - b.lastMessage.createdTimestamp; - }).array(); - - if (this.readMail.children.size >= 45) await this.sweepChannels({ count: 5, force: true }); - - let counter = 0; - for (const channel of channels) { - await channel.edit({ parentID: this.readMail.id }); - counter++; - if (counter === 5) break; - } - } - async sendCannedResponse({ message, responseName, anon }) { const content = this.getCanned(responseName); @@ -446,7 +429,7 @@ class Modmail { this.client.logger.info(`Swept ${channelCount} channels from graveyard, cleaning up answered...`); const answered = this.readMail.children - .filter((channel) => !channel.lastMessage || channel.answered && channel.lastMessage.createdTimestamp < Date.now() - 15 * 60 * 1000 || force) + .filter((channel) => !channel.lastMessage || channel.lastMessage.createdTimestamp < Date.now() - 15 * 60 * 1000 || force) .sort((a, b) => { if (!a.lastMessage) return -1; if (!b.lastMessage) return 1; @@ -466,6 +449,23 @@ class Modmail { } + async overflow() { // Overflows new modmail category into read + const channels = this.newMail.children.sort((a, b) => { + if (!a.lastMessage) return -1; + if (!b.lastMessage) return 1; + return a.lastMessage.createdTimestamp - b.lastMessage.createdTimestamp; + }).array(); + + if (this.readMail.children.size >= 45) await this.sweepChannels({ count: 5, force: true }); + + let counter = 0; + for (const channel of channels) { + await channel.edit({ parentID: this.readMail.id }); + counter++; + if (counter === 5) break; + } + } + async markread(message) { const { channel, author } = message; diff --git a/structure/commands/CannedReply.js b/structure/commands/CannedReply.js index df60e5f..1d1eea8 100644 --- a/structure/commands/CannedReply.js +++ b/structure/commands/CannedReply.js @@ -36,7 +36,7 @@ class CannedReply extends Command { str += `**${name}:** ${content}\n`; } if (str.length) await channel.send(str).catch(this.client.logger.error.bind(this.client.logger)); - return; + return '**__None__**'; } return this.client.modmail.sendCannedResponse({ message, responseName: content.trim(), anon }); diff --git a/structure/commands/Logs.js b/structure/commands/Logs.js index 9ef6a0a..9020268 100644 --- a/structure/commands/Logs.js +++ b/structure/commands/Logs.js @@ -26,7 +26,7 @@ class Logs extends Command { const { member, channel } = message; const history = await this.client.modmail.loadHistory(user.id); - const page = this.paginate([...history].reverse(), pageNr, 10); + const page = this.paginate([...history].filter((e) => !e.markread).reverse(), pageNr, 10); const embed = { author: {