From f6c58b366235ebfe10f132f359ee99878c4678ea Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Mon, 29 Nov 2021 12:48:45 +0200 Subject: [PATCH] fix for logs command breaking with missing content --- structure/Client.js | 1 + structure/Modmail.js | 2 +- structure/commands/Logs.js | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/structure/Client.js b/structure/Client.js index c7d8a2a..c249a63 100644 --- a/structure/Client.js +++ b/structure/Client.js @@ -67,6 +67,7 @@ class ModmailClient extends Client { }); this._ready = true; + await this.modmail.reminderChannel.send(`Modmail bot booted and ready.`); } diff --git a/structure/Modmail.js b/structure/Modmail.js index ed495e1..c6b787c 100644 --- a/structure/Modmail.js +++ b/structure/Modmail.js @@ -371,7 +371,7 @@ class Modmail { await this.lastReminder.delete(); } this.lastReminder = await channel.send(str); - this.cache.lastReminder = this.lastReminder.id; + this.cache.misc.lastReminder = this.lastReminder.id; } diff --git a/structure/commands/Logs.js b/structure/commands/Logs.js index 9d1cf84..6ca571d 100644 --- a/structure/commands/Logs.js +++ b/structure/commands/Logs.js @@ -45,9 +45,15 @@ class Logs extends Command { for (const entry of page.items) { // eslint-disable-next-line no-shadow const user = await this.client.resolveUser(entry.author); + let value = entry.content.substring(0, 1000) + (entry.content.length > 1000 ? '...' : ''); + if (!value.length) value = entry.attachments.join('\n'); embed.fields.push({ name: `${user.tag}${entry.anon ? ' (ANON)' : ''} @ ${new Date(entry.timestamp).toUTCString()}`, - value: entry.content.substring(0, 1000) + (entry.content.length > 1000 ? '...' : '') + value + }); + if (entry.attachments?.length && entry.content.length) embed.fields.push({ + name: `Attachments`, + value: entry.attachments.join('\n') }); }