diff --git a/src/modules/helpchan.ts b/src/modules/helpchan.ts index 5cfca5e7..db36549b 100644 --- a/src/modules/helpchan.ts +++ b/src/modules/helpchan.ts @@ -356,7 +356,7 @@ export class HelpChanModule extends Module { // to creation date), so sorting is needed to find the latest embed. let lastMessage = channel.messages.cache .array() - .filter(m => m.author.id === this.client.user?.id) + .filter(m => m.author && m.author.id === this.client.user?.id) .sort((m1, m2) => m2.createdTimestamp - m1.createdTimestamp) .find(m => m.embeds.some(isStatusEmbed)); @@ -364,7 +364,7 @@ export class HelpChanModule extends Module { // Fetch has a stable order, with recent messages first lastMessage = (await channel.messages.fetch({ limit: 5 })) .array() - .filter(m => m.author.id === this.client.user?.id) + .filter(m => m.author && m.author.id === this.client.user?.id) .find(m => m.embeds.some(isStatusEmbed)); if (lastMessage) {