From cdc2055e7880702d7d6d2ce363f0565a378ddcc3 Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Wed, 11 Sep 2024 23:51:43 +0200 Subject: [PATCH 01/17] feat(Plugin): Filter bot mentions --- src/plugins/filterBotMentions/README.md | 5 ++ src/plugins/filterBotMentions/index.tsx | 69 +++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 src/plugins/filterBotMentions/README.md create mode 100644 src/plugins/filterBotMentions/index.tsx diff --git a/src/plugins/filterBotMentions/README.md b/src/plugins/filterBotMentions/README.md new file mode 100644 index 000000000..91d4213bb --- /dev/null +++ b/src/plugins/filterBotMentions/README.md @@ -0,0 +1,5 @@ +# Filter Bot Mentions +Allows you to filter bot mentions in recent mentions panel. + +# Usage +You can include/exclude bot mentions via the checkbox in recent mentions panel, or the plugin settings. diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx new file mode 100644 index 000000000..753079dc5 --- /dev/null +++ b/src/plugins/filterBotMentions/index.tsx @@ -0,0 +1,69 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { definePluginSettings } from "@api/Settings"; +import { Devs } from "@utils/constants"; +import { getCurrentGuild } from "@utils/discord"; +import definePlugin, { OptionType } from "@utils/types"; +import { findByProps } from "@webpack"; +import { FluxDispatcher } from "@webpack/common"; + +const settings = definePluginSettings({ + toggle: { + type: OptionType.BOOLEAN, + description: "Filter out mentions by bots", + default: false, + }, +}); + + +export default definePlugin({ + name: "Filter Bot Mentions", + description: "Filter mentions by bots", + authors: [Devs.Taran], + version: "1.0.0", + + patches: [ + { + find: "type:\"LOAD_RECENT_MENTIONS_SUCCESS\"", + replacement: { + match: /dispatch\(\{type:"LOAD_RECENT_MENTIONS_SUCCESS",messages:(\i)/, + replace: "$&.filter(function (message) {if (!message.author.bot){return true} else {return $self.settings.store.toggle}})" + } + }, + { + find: "analyticsName:\"Recent Mentions\"", + replacement: { + match: /channel:\i,messages:\i/, + replace: "$&?.filter(function (message) {if (!message.author.bot){return true} else {return $self.settings.store.toggle}})" + } + }, + { + find: "mentions-filter", + replacement: { + match: /children:\[\(0,(\i)\.jsx\)\((\i).{0,200}(\i)\.(\i)\.setGuildFilter.{0,100}checked:(\i).{0,200}checked:(\i).{0,300}checked:(.{0,30})\}\)\]/, + replace: "$&.concat([(0,$1.jsx)($2.MenuCheckboxItem, {id:\"Bots\", label:\"Include mentions by bots\", action: function() {$self.toggleBotMentions();$self.reloadMentions($5, $6, $7)}, checked: $self.settings.store.toggle})])" + } + } + + ], + settings, + reloadMentions(everyone, role, all_servers) { + FluxDispatcher.dispatch({ type: "CLEAR_MENTIONS" }); + if (all_servers === false) { + all_servers = getCurrentGuild()?.id; + } else { + all_servers = null; + } + + findByProps("fetchRecentMentions").fetchRecentMentions(null, null, all_servers, role, everyone); + + }, + toggleBotMentions() { + this.settings.store.toggle = !this.settings.store.toggle; + } + +}); From e7a233f1d3f6b6e7caf29a08b2764c1f6c983cc7 Mon Sep 17 00:00:00 2001 From: AdiGro Date: Thu, 12 Sep 2024 00:00:32 +0200 Subject: [PATCH 02/17] Update index.tsx --- src/plugins/filterBotMentions/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index 753079dc5..cd6f05872 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -23,7 +23,7 @@ const settings = definePluginSettings({ export default definePlugin({ name: "Filter Bot Mentions", description: "Filter mentions by bots", - authors: [Devs.Taran], + authors: [{name:"Taran", id:482951588055351306n}], version: "1.0.0", patches: [ From bc655d673b63e1bbcc3de218c3fda51c0a842bd9 Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Thu, 12 Sep 2024 00:03:55 +0200 Subject: [PATCH 03/17] lint --- src/plugins/filterBotMentions/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index cd6f05872..f70756022 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -23,7 +23,7 @@ const settings = definePluginSettings({ export default definePlugin({ name: "Filter Bot Mentions", description: "Filter mentions by bots", - authors: [{name:"Taran", id:482951588055351306n}], + authors: [{ name: "Taran", id: 482951588055351306n }], version: "1.0.0", patches: [ From cd2568cfcd4cbc4a18ec2b881ad41b3b0abba785 Mon Sep 17 00:00:00 2001 From: AdiGro Date: Thu, 12 Sep 2024 02:18:12 +0200 Subject: [PATCH 04/17] Update src/plugins/filterBotMentions/index.tsx Co-authored-by: sadan4 <117494111+sadan4@users.noreply.github.com> --- src/plugins/filterBotMentions/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index f70756022..5141f490e 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -24,7 +24,6 @@ export default definePlugin({ name: "Filter Bot Mentions", description: "Filter mentions by bots", authors: [{ name: "Taran", id: 482951588055351306n }], - version: "1.0.0", patches: [ { From 73a6d43840d88edb72154de1b86db91bcc2b833e Mon Sep 17 00:00:00 2001 From: AdiGro Date: Thu, 12 Sep 2024 02:18:28 +0200 Subject: [PATCH 05/17] Update src/plugins/filterBotMentions/index.tsx Co-authored-by: sadan4 <117494111+sadan4@users.noreply.github.com> --- src/plugins/filterBotMentions/index.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index 5141f490e..f84ed1195 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -52,11 +52,7 @@ export default definePlugin({ settings, reloadMentions(everyone, role, all_servers) { FluxDispatcher.dispatch({ type: "CLEAR_MENTIONS" }); - if (all_servers === false) { - all_servers = getCurrentGuild()?.id; - } else { - all_servers = null; - } + all_servers = all_servers ? null : getCurrentGuild()?.id; findByProps("fetchRecentMentions").fetchRecentMentions(null, null, all_servers, role, everyone); From 35bc98b2b507dd0b8d3775956376f9bc361361b6 Mon Sep 17 00:00:00 2001 From: AdiGro Date: Thu, 12 Sep 2024 02:21:25 +0200 Subject: [PATCH 06/17] add [myself] to devs --- src/utils/constants.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 0572fa102..62a2bad67 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -575,6 +575,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "RamziAH", id: 1279957227612147747n, }, + Taran: { + name: "Taran", + id: 482951588055351306n + }, } satisfies Record); // iife so #__PURE__ works correctly From 18c2b7d7302b69ae1bffec35e65ecf6b50d885e1 Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Thu, 12 Sep 2024 02:27:59 +0200 Subject: [PATCH 07/17] add to Devs --- src/plugins/filterBotMentions/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index f84ed1195..91bd58fe9 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -23,7 +23,7 @@ const settings = definePluginSettings({ export default definePlugin({ name: "Filter Bot Mentions", description: "Filter mentions by bots", - authors: [{ name: "Taran", id: 482951588055351306n }], + authors: [Devs.Taran], patches: [ { @@ -52,7 +52,7 @@ export default definePlugin({ settings, reloadMentions(everyone, role, all_servers) { FluxDispatcher.dispatch({ type: "CLEAR_MENTIONS" }); - all_servers = all_servers ? null : getCurrentGuild()?.id; + all_servers = all_servers ? null : getCurrentGuild()?.id; findByProps("fetchRecentMentions").fetchRecentMentions(null, null, all_servers, role, everyone); From 2b887fda184d1daed4633cb5f3d3e2f545f7d6dd Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Thu, 12 Sep 2024 02:28:06 +0200 Subject: [PATCH 08/17] add types --- src/plugins/filterBotMentions/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index 91bd58fe9..64b749dba 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -50,7 +50,7 @@ export default definePlugin({ ], settings, - reloadMentions(everyone, role, all_servers) { + reloadMentions(everyone: boolean, role: boolean, all_servers: boolean) { FluxDispatcher.dispatch({ type: "CLEAR_MENTIONS" }); all_servers = all_servers ? null : getCurrentGuild()?.id; From 608fdd4f969b55aa3853a546be20e3d01b26ea8c Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Thu, 12 Sep 2024 02:30:40 +0200 Subject: [PATCH 09/17] use camcel case for plugin names --- src/plugins/filterBotMentions/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index 64b749dba..6f88e5500 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -21,7 +21,7 @@ const settings = definePluginSettings({ export default definePlugin({ - name: "Filter Bot Mentions", + name: "FilterBotMentions", description: "Filter mentions by bots", authors: [Devs.Taran], From ecfc09ac3f27423a2574978e073964700cc2d335 Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Thu, 12 Sep 2024 02:31:47 +0200 Subject: [PATCH 10/17] use camcel case for plugin names --- src/plugins/filterBotMentions/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/filterBotMentions/README.md b/src/plugins/filterBotMentions/README.md index 91d4213bb..a3f3bba5e 100644 --- a/src/plugins/filterBotMentions/README.md +++ b/src/plugins/filterBotMentions/README.md @@ -1,4 +1,4 @@ -# Filter Bot Mentions +# FilterBotMentions Allows you to filter bot mentions in recent mentions panel. # Usage From 6b952c24be19831b3ab790216e64f7dc22cd5ed5 Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Thu, 12 Sep 2024 02:32:43 +0200 Subject: [PATCH 11/17] edit plugin description to be less misunderstandable --- src/plugins/filterBotMentions/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index 6f88e5500..bbb0a27f4 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -22,7 +22,7 @@ const settings = definePluginSettings({ export default definePlugin({ name: "FilterBotMentions", - description: "Filter mentions by bots", + description: "Filter mentions by bots in inbox", authors: [Devs.Taran], patches: [ From 3bf235d115c674e0c4d2450dff847c04eb8fc417 Mon Sep 17 00:00:00 2001 From: AdiGro Date: Thu, 12 Sep 2024 02:34:44 +0200 Subject: [PATCH 12/17] Update README.md --- src/plugins/filterBotMentions/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/filterBotMentions/README.md b/src/plugins/filterBotMentions/README.md index a3f3bba5e..b87af5335 100644 --- a/src/plugins/filterBotMentions/README.md +++ b/src/plugins/filterBotMentions/README.md @@ -2,4 +2,9 @@ Allows you to filter bot mentions in recent mentions panel. # Usage -You can include/exclude bot mentions via the checkbox in recent mentions panel, or the plugin settings. +You can include/exclude mentions by bots in the box either using the checkbox in recent mentions panel, or in the plugin settings. +![image](https://github.com/user-attachments/assets/fdf973eb-23ef-4101-b4de-e3fb6663f41b) + +![image](https://github.com/user-attachments/assets/a80a41fc-9bae-4612-a23a-b1894e0f8fd2) + + From 24fa55bbbe83d5a01a88f4fd975632b66d296eda Mon Sep 17 00:00:00 2001 From: AdiGro Date: Thu, 12 Sep 2024 02:35:50 +0200 Subject: [PATCH 13/17] Update README.md --- src/plugins/filterBotMentions/README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/filterBotMentions/README.md b/src/plugins/filterBotMentions/README.md index b87af5335..7b74176b6 100644 --- a/src/plugins/filterBotMentions/README.md +++ b/src/plugins/filterBotMentions/README.md @@ -3,8 +3,11 @@ Allows you to filter bot mentions in recent mentions panel. # Usage You can include/exclude mentions by bots in the box either using the checkbox in recent mentions panel, or in the plugin settings. -![image](https://github.com/user-attachments/assets/fdf973eb-23ef-4101-b4de-e3fb6663f41b) +Include mentions by bots: ![image](https://github.com/user-attachments/assets/a80a41fc-9bae-4612-a23a-b1894e0f8fd2) +Excluded mentions by bots: +![image](https://github.com/user-attachments/assets/fdf973eb-23ef-4101-b4de-e3fb6663f41b) + From 4d9acac992dcd76d3ba948277b2269f06408c95e Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Thu, 12 Sep 2024 03:11:23 +0200 Subject: [PATCH 14/17] find prop outside of the function and added types --- src/plugins/filterBotMentions/index.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index bbb0a27f4..981485237 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -8,7 +8,7 @@ import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import { getCurrentGuild } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; -import { findByProps } from "@webpack"; +import { findByPropsLazy } from "@webpack"; import { FluxDispatcher } from "@webpack/common"; const settings = definePluginSettings({ @@ -19,6 +19,14 @@ const settings = definePluginSettings({ }, }); +type fetchRecentMentionsType = (before: BigInt | null, limit: Number | null, all_servers: string | null | undefined, role: boolean, everyone: boolean,) => void; +const { fetchRecentMentions } = findByPropsLazy("fetchRecentMentions") as { fetchRecentMentions: fetchRecentMentionsType; }; + +interface ReloadMentions { + everyone: boolean; + role: boolean; + all_servers: boolean; +} export default definePlugin({ name: "FilterBotMentions", @@ -50,14 +58,13 @@ export default definePlugin({ ], settings, - reloadMentions(everyone: boolean, role: boolean, all_servers: boolean) { + reloadMentions({ everyone, role, all_servers }: ReloadMentions): void { FluxDispatcher.dispatch({ type: "CLEAR_MENTIONS" }); - all_servers = all_servers ? null : getCurrentGuild()?.id; - - findByProps("fetchRecentMentions").fetchRecentMentions(null, null, all_servers, role, everyone); + const serverToFilter: string | undefined | null = all_servers ? null : getCurrentGuild()?.id; + fetchRecentMentions(null, null, serverToFilter, role, everyone); }, - toggleBotMentions() { + toggleBotMentions(): void { this.settings.store.toggle = !this.settings.store.toggle; } From 1755c2cf6f301fdfd5812fcaaf8624cefb0b8285 Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Thu, 12 Sep 2024 04:55:54 +0200 Subject: [PATCH 15/17] extract filter callback into a function --- src/plugins/filterBotMentions/index.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index 981485237..d81cd1811 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -10,6 +10,8 @@ import { getCurrentGuild } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; import { FluxDispatcher } from "@webpack/common"; +import { Message } from "discord-types/general"; + const settings = definePluginSettings({ toggle: { @@ -38,14 +40,14 @@ export default definePlugin({ find: "type:\"LOAD_RECENT_MENTIONS_SUCCESS\"", replacement: { match: /dispatch\(\{type:"LOAD_RECENT_MENTIONS_SUCCESS",messages:(\i)/, - replace: "$&.filter(function (message) {if (!message.author.bot){return true} else {return $self.settings.store.toggle}})" + replace: "$&.filter($self.filterMessages)" } }, { find: "analyticsName:\"Recent Mentions\"", replacement: { match: /channel:\i,messages:\i/, - replace: "$&?.filter(function (message) {if (!message.author.bot){return true} else {return $self.settings.store.toggle}})" + replace: "$&?.filter($self.filterMessages)" } }, { @@ -65,7 +67,12 @@ export default definePlugin({ }, toggleBotMentions(): void { - this.settings.store.toggle = !this.settings.store.toggle; + settings.store.toggle = !settings.store.toggle; + }, + filterMessages(message: Message): boolean { + console.log(this, self, self.settings); + return !message.author.bot || settings.store.toggle; + } }); From 11dd4cf3b05b10409ad36bee735852a69bae5ca3 Mon Sep 17 00:00:00 2001 From: AdiGro Date: Thu, 12 Sep 2024 05:02:27 +0200 Subject: [PATCH 16/17] Update src/plugins/filterBotMentions/index.tsx Co-authored-by: sadan4 <117494111+sadan4@users.noreply.github.com> --- src/plugins/filterBotMentions/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index d81cd1811..aee8fc104 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -70,7 +70,6 @@ export default definePlugin({ settings.store.toggle = !settings.store.toggle; }, filterMessages(message: Message): boolean { - console.log(this, self, self.settings); return !message.author.bot || settings.store.toggle; } From 513eccb70a0c0cc0d07fb59bfe29ccbc5e915750 Mon Sep 17 00:00:00 2001 From: Taran Grover Date: Fri, 13 Sep 2024 01:31:11 +0200 Subject: [PATCH 17/17] change patches and extract code in functions --- src/plugins/filterBotMentions/index.tsx | 55 ++++++++++++++----------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/plugins/filterBotMentions/index.tsx b/src/plugins/filterBotMentions/index.tsx index aee8fc104..ae1d97286 100644 --- a/src/plugins/filterBotMentions/index.tsx +++ b/src/plugins/filterBotMentions/index.tsx @@ -8,27 +8,25 @@ import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import { getCurrentGuild } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; -import { findByPropsLazy } from "@webpack"; -import { FluxDispatcher } from "@webpack/common"; +import { findByPropsLazy, findStoreLazy } from "@webpack"; +import { Menu } from "@webpack/common"; import { Message } from "discord-types/general"; const settings = definePluginSettings({ toggle: { type: OptionType.BOOLEAN, - description: "Filter out mentions by bots", - default: false, + description: "Include mentions by bots in inbox", + default: true, }, }); +type RecentMentionsStore = { guildFilter: string, roleFilter: boolean, everyoneFilter: boolean; }; type fetchRecentMentionsType = (before: BigInt | null, limit: Number | null, all_servers: string | null | undefined, role: boolean, everyone: boolean,) => void; -const { fetchRecentMentions } = findByPropsLazy("fetchRecentMentions") as { fetchRecentMentions: fetchRecentMentionsType; }; -interface ReloadMentions { - everyone: boolean; - role: boolean; - all_servers: boolean; -} +const { fetchRecentMentions } = findByPropsLazy("fetchRecentMentions") as { fetchRecentMentions: fetchRecentMentionsType; }; +const recentMentionsStore = findStoreLazy("RecentMentionsStore") as RecentMentionsStore; + export default definePlugin({ name: "FilterBotMentions", @@ -37,41 +35,50 @@ export default definePlugin({ patches: [ { - find: "type:\"LOAD_RECENT_MENTIONS_SUCCESS\"", + find: "get lastLoaded", replacement: { - match: /dispatch\(\{type:"LOAD_RECENT_MENTIONS_SUCCESS",messages:(\i)/, + match: /getMentions.{0,30}\?\i/, replace: "$&.filter($self.filterMessages)" } }, - { - find: "analyticsName:\"Recent Mentions\"", - replacement: { - match: /channel:\i,messages:\i/, - replace: "$&?.filter($self.filterMessages)" - } - }, { find: "mentions-filter", replacement: { - match: /children:\[\(0,(\i)\.jsx\)\((\i).{0,200}(\i)\.(\i)\.setGuildFilter.{0,100}checked:(\i).{0,200}checked:(\i).{0,300}checked:(.{0,30})\}\)\]/, - replace: "$&.concat([(0,$1.jsx)($2.MenuCheckboxItem, {id:\"Bots\", label:\"Include mentions by bots\", action: function() {$self.toggleBotMentions();$self.reloadMentions($5, $6, $7)}, checked: $self.settings.store.toggle})])" + match: /children:\[\(0,\i\.jsx\).{0,600}\}\)\]/, + replace: "$&.concat($self.patchMenu())" } } ], settings, - reloadMentions({ everyone, role, all_servers }: ReloadMentions): void { - FluxDispatcher.dispatch({ type: "CLEAR_MENTIONS" }); + reloadMentions(): void { + const all_servers: boolean = recentMentionsStore.guildFilter === "ALL_SERVERS"; + const { roleFilter: role, everyoneFilter: everyone } = recentMentionsStore; const serverToFilter: string | undefined | null = all_servers ? null : getCurrentGuild()?.id; fetchRecentMentions(null, null, serverToFilter, role, everyone); - }, + toggleBotMentions(): void { settings.store.toggle = !settings.store.toggle; }, + filterMessages(message: Message): boolean { return !message.author.bot || settings.store.toggle; + }, + + patchMenu() { + return ( + { + this.toggleBotMentions(); + this.reloadMentions(); + }} + checked={settings.store.toggle} + /> + ); } });