From a6f6a21cf5a64792cb049067b6e3536636fcfa37 Mon Sep 17 00:00:00 2001 From: Sqaaakoi Date: Sat, 11 Jan 2025 01:36:36 +1300 Subject: [PATCH] Fix property access causing error --- index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.tsx b/index.tsx index c47e4fb..d3c70b7 100644 --- a/index.tsx +++ b/index.tsx @@ -47,7 +47,8 @@ export default definePlugin({ if (settings.store.currentVC && SelectedChannelStore.getVoiceChannelId() === channelId) return true; const threshold = Date.now() - (settings.store[ChannelStore.getChannel(channelId).isPrivate() ? "thresholdInDms" : "threshold"] * 1000); // discord-types and the MessageStore types are so wrong and cursed - if ((MessageStore as any).getLastEditableMessage(channelId).timestamp > threshold) return true; + const lastMessage = (MessageStore as any).getLastEditableMessage(channelId); + if (lastMessage && lastMessage?.timestamp > threshold) return true; return false; }