Fix property access causing error

This commit is contained in:
Sqaaakoi 2025-01-11 01:36:36 +13:00
parent add1dbd789
commit a6f6a21cf5
No known key found for this signature in database

View file

@ -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;
}