From d9e6648b337494ef8ca88ee7ff4b29950bcf0410 Mon Sep 17 00:00:00 2001 From: Grzesiek11 Date: Fri, 2 Aug 2024 13:03:22 +0200 Subject: [PATCH] Improve resilience to Discord changes --- src/plugins/ircColors/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/ircColors/index.ts b/src/plugins/ircColors/index.ts index 71a2ab6c0..530890c2c 100644 --- a/src/plugins/ircColors/index.ts +++ b/src/plugins/ircColors/index.ts @@ -83,9 +83,17 @@ export default definePlugin({ ], settings, calculateNameColorForMessageContext(context: any) { - return calculateNameColorForUser(BigInt(context.message.author.id)); + const id = context?.message?.author?.id; + if (id == null) { + return null; + } + return calculateNameColorForUser(BigInt(id)); }, calculateNameColorForListContext(context: any) { - return calculateNameColorForUser(BigInt(context.user.id)); + const id = context?.user?.id; + if (id == null) { + return null; + } + return calculateNameColorForUser(BigInt(id)); }, });