Skip to content

Commit 057cdad

Browse files
committed
Fix sentry issue CSZ-BOT-1G
1 parent 411ce5d commit 057cdad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/handler/messageDeleteHandler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import log from "#log";
1313
const deleteInlineRepliesFromBot = (messageRef: Message<true>, botUser: ClientUser) =>
1414
Promise.allSettled(
1515
messageRef.channel.messages.cache
16-
.filter(m => m.author.id === botUser.id && m.reference?.messageId === messageRef.id)
16+
// the author?. is needed because the message might not be cached, and thus author is null (which is not reflected in the type system)
17+
.filter(m => m.author?.id === botUser.id && m.reference?.messageId === messageRef.id)
1718
.map(m => m.delete()),
1819
);
1920

0 commit comments

Comments
 (0)