bugfix to channel sweeping
This commit is contained in:
parent
d0dd677294
commit
916401de89
@ -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;
|
||||
|
@ -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 });
|
||||
|
||||
|
@ -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: {
|
||||
|
Loading…
Reference in New Issue
Block a user