fix for logs command breaking with missing content

This commit is contained in:
Erik 2021-11-29 12:48:45 +02:00
parent 21a96ea481
commit f6c58b3662
No known key found for this signature in database
GPG Key ID: FEFF4B220DDF5589
3 changed files with 9 additions and 2 deletions

View File

@ -67,6 +67,7 @@ class ModmailClient extends Client {
});
this._ready = true;
await this.modmail.reminderChannel.send(`Modmail bot booted and ready.`);
}

View File

@ -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;
}

View File

@ -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')
});
}