From 8472c3823eb6bf4338f4631e8485c30a64568948 Mon Sep 17 00:00:00 2001 From: ActuallyTheSun <78964224+ActuallyTheSun@users.noreply.github.com> Date: Sun, 25 Jun 2023 19:31:39 +0300 Subject: [PATCH] =?UTF-8?q?feat(=F0=9F=97=BF):=20ignore=20blocked=20users?= =?UTF-8?q?=20(#1327)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: V --- src/plugins/moyai.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/moyai.ts b/src/plugins/moyai.ts index 1a48bd67b..b8d76dacf 100644 --- a/src/plugins/moyai.ts +++ b/src/plugins/moyai.ts @@ -21,7 +21,7 @@ import { makeRange } from "@components/PluginSettings/components/SettingSliderCo import { Devs } from "@utils/constants"; import { sleep } from "@utils/misc"; import definePlugin, { OptionType } from "@utils/types"; -import { SelectedChannelStore, UserStore } from "@webpack/common"; +import { RelationshipStore, SelectedChannelStore, UserStore } from "@webpack/common"; import { Message, ReactionEmoji } from "discord-types/general"; interface IMessageCreate { @@ -37,6 +37,7 @@ interface IReactionAdd { optimistic: boolean; channelId: string; messageId: string; + messageAuthorId: string; userId: "195136840355807232"; emoji: ReactionEmoji; } @@ -71,6 +72,11 @@ const settings = definePluginSettings({ description: "Ignore bots", type: OptionType.BOOLEAN, default: true + }, + ignoreBlocked: { + description: "Ignore blocked users", + type: OptionType.BOOLEAN, + default: true } }); @@ -85,6 +91,7 @@ export default definePlugin({ if (optimistic || type !== "MESSAGE_CREATE") return; if (message.state === "SENDING") return; if (settings.store.ignoreBots && message.author?.bot) return; + if (settings.store.ignoreBlocked && RelationshipStore.isBlocked(message.author?.id)) return; if (!message.content) return; if (channelId !== SelectedChannelStore.getChannelId()) return; @@ -96,9 +103,10 @@ export default definePlugin({ } }, - MESSAGE_REACTION_ADD({ optimistic, type, channelId, userId, emoji }: IReactionAdd) { + MESSAGE_REACTION_ADD({ optimistic, type, channelId, userId, messageAuthorId, emoji }: IReactionAdd) { if (optimistic || type !== "MESSAGE_REACTION_ADD") return; if (settings.store.ignoreBots && UserStore.getUser(userId)?.bot) return; + if (settings.store.ignoreBlocked && RelationshipStore.isBlocked(messageAuthorId)) return; if (channelId !== SelectedChannelStore.getChannelId()) return; const name = emoji.name.toLowerCase();