don't send reminder when no modmail in q

This commit is contained in:
Erik 2021-06-22 00:53:00 +03:00
parent b71f64d15d
commit 14a0f0f1a0
No known key found for this signature in database
GPG Key ID: 7E862371D3409F16

View File

@ -357,11 +357,13 @@ class Modmail {
const channel = this.reminderChannel; const channel = this.reminderChannel;
const amount = this.queue.length; const amount = this.queue.length;
let str = '';
if (!amount) str = 'No modmail in queue'; if (!amount) {
else str = `${amount} modmail in queue.`; if (this.lastReminder) await this.lastReminder.delete();
return;
}
const str = `${amount} modmail in queue.`;
this.client.logger.debug(`Sending modmail reminder, #mm: ${amount}`); this.client.logger.debug(`Sending modmail reminder, #mm: ${amount}`);
if (this.lastReminder) { if (this.lastReminder) {
if (channel.lastMessage.id === this.lastReminder.id) return this.lastReminder.edit(str); if (channel.lastMessage.id === this.lastReminder.id) return this.lastReminder.edit(str);