fix for logs command breaking with missing content
This commit is contained in:
parent
21a96ea481
commit
f6c58b3662
@ -67,6 +67,7 @@ class ModmailClient extends Client {
|
||||
});
|
||||
|
||||
this._ready = true;
|
||||
await this.modmail.reminderChannel.send(`Modmail bot booted and ready.`);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -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')
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user