From 7809d2d87ad47d453e59f957686f4a67d0bad90f Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 06:08:58 -0700 Subject: [PATCH 01/23] Init --- src/plugins/customBanReasons/index.tsx | 100 +++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 src/plugins/customBanReasons/index.tsx diff --git a/src/plugins/customBanReasons/index.tsx b/src/plugins/customBanReasons/index.tsx new file mode 100644 index 0000000000..ccda69f8bf --- /dev/null +++ b/src/plugins/customBanReasons/index.tsx @@ -0,0 +1,100 @@ +/* + * 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 definePlugin, { OptionType } from "@utils/types"; +import { Button, Forms, TextInput, useEffect, useState } from "@webpack/common"; + +function ReasonsComponent() { + const [reasons, setReasons] = useState(settings.store.reasons as string[]); + + useEffect(() => { + settings.store.reasons = reasons; + }, [reasons]); + + return ( + + {reasons.map((reason, index) => ( +
+ { + reasons[index] = value; + setReasons([...reasons]); + }} + placeholder="Reason" + /> + +
+ ))} + +
+ ); +} + +const settings = definePluginSettings({ + reasons: { + description: "Your custom reasons", + type: OptionType.COMPONENT, + default: [ + "Suspicious or spam account", + "Compromised or spam account", + "Breaking server rules", + ], + component: ReasonsComponent, + }, +}); + +export default definePlugin({ + name: "CustomBanReasons", + description: "Create custom reasons to use in the Discord ban modal.", + authors: [Devs.Inbestigator], + patches: [ + { + find: 'username:"@".concat(_.default.getName', + replacement: { + match: /U=\[([\s\S]*?)\]/, + replace: "U=$self.getReasons()", + }, + }, + ], + getReasons: (): { name: string; value: string; }[] => { + return settings.store.reasons.map((reason: string) => { + return { name: reason, value: reason }; + }); + }, + settings, +}); From 15b789171b9c50c8415edf90b244816ace4924a9 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 06:10:16 -0700 Subject: [PATCH 02/23] Grid update --- src/plugins/customBanReasons/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/customBanReasons/index.tsx b/src/plugins/customBanReasons/index.tsx index ccda69f8bf..4c2ddfe2d3 100644 --- a/src/plugins/customBanReasons/index.tsx +++ b/src/plugins/customBanReasons/index.tsx @@ -25,7 +25,7 @@ function ReasonsComponent() { padding: 0, paddingBottom: "0.5rem", gap: "0.5rem", - gridTemplateColumns: "auto", + gridTemplateColumns: "6fr 1fr", }} > Date: Sun, 9 Jun 2024 06:15:44 -0700 Subject: [PATCH 03/23] Updated name --- src/plugins/betterBanReasons/README.md | 6 ++++++ .../{customBanReasons => betterBanReasons}/index.tsx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/plugins/betterBanReasons/README.md rename src/plugins/{customBanReasons => betterBanReasons}/index.tsx (99%) diff --git a/src/plugins/betterBanReasons/README.md b/src/plugins/betterBanReasons/README.md new file mode 100644 index 0000000000..5eb86f3916 --- /dev/null +++ b/src/plugins/betterBanReasons/README.md @@ -0,0 +1,6 @@ +### Create custom reasons to use in the Discord ban modal. + +![image](https://github.com/Vendicated/Vencord/assets/119569726/d0c1bd70-00b1-4786-a2f7-7db809f15ab0) +![image](https://github.com/Vendicated/Vencord/assets/119569726/411411f6-f2b7-4747-b6e7-4615116dcf22) + +I do not think that we're **easily** and **non-jankily** able to add the click functionality diff --git a/src/plugins/customBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx similarity index 99% rename from src/plugins/customBanReasons/index.tsx rename to src/plugins/betterBanReasons/index.tsx index 4c2ddfe2d3..e3a440bfa8 100644 --- a/src/plugins/customBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -79,7 +79,7 @@ const settings = definePluginSettings({ }); export default definePlugin({ - name: "CustomBanReasons", + name: "BetterBanReasons", description: "Create custom reasons to use in the Discord ban modal.", authors: [Devs.Inbestigator], patches: [ From 4e0887fc67036123a421df994e74c0208d3be881 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 06:17:38 -0700 Subject: [PATCH 04/23] Update README.md --- src/plugins/betterBanReasons/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/betterBanReasons/README.md b/src/plugins/betterBanReasons/README.md index 5eb86f3916..916f729869 100644 --- a/src/plugins/betterBanReasons/README.md +++ b/src/plugins/betterBanReasons/README.md @@ -3,4 +3,6 @@ ![image](https://github.com/Vendicated/Vencord/assets/119569726/d0c1bd70-00b1-4786-a2f7-7db809f15ab0) ![image](https://github.com/Vendicated/Vencord/assets/119569726/411411f6-f2b7-4747-b6e7-4615116dcf22) -I do not think that we're **easily** and **non-jankily** able to add the click functionality +I do not think that we're **easily** and **non-jankily** able to add the click functionality, so I didn't implement that. If anybody gets it working, shoot me a message on Discord. + +[Original plugin request](https://github.com/Vencord/plugin-requests/issues/607) From 5834fd556891f10f293d32e3b1b9f91bd8b7cbcd Mon Sep 17 00:00:00 2001 From: Inbestigator <119569726+Inbestigator@users.noreply.github.com> Date: Sun, 9 Jun 2024 13:04:13 -0700 Subject: [PATCH 05/23] Update src/plugins/betterBanReasons/index.tsx Co-authored-by: vee --- src/plugins/betterBanReasons/index.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index e3a440bfa8..1cae47eed3 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -10,11 +10,7 @@ import definePlugin, { OptionType } from "@utils/types"; import { Button, Forms, TextInput, useEffect, useState } from "@webpack/common"; function ReasonsComponent() { - const [reasons, setReasons] = useState(settings.store.reasons as string[]); - - useEffect(() => { - settings.store.reasons = reasons; - }, [reasons]); + const { reasons } = settings.use(["reasons"]); return ( From 3dc2eb65a14dd6d6440a5b87650dbce7b8f4b924 Mon Sep 17 00:00:00 2001 From: Inbestigator <119569726+Inbestigator@users.noreply.github.com> Date: Sun, 9 Jun 2024 13:04:21 -0700 Subject: [PATCH 06/23] Update src/plugins/betterBanReasons/index.tsx Co-authored-by: vee --- src/plugins/betterBanReasons/index.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index 1cae47eed3..ce8f38847b 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -87,10 +87,10 @@ export default definePlugin({ }, }, ], - getReasons: (): { name: string; value: string; }[] => { - return settings.store.reasons.map((reason: string) => { - return { name: reason, value: reason }; - }); + getReasons() { + return settings.store.reasons.map(reason => ( + { name: reason, value: reason } + )); }, settings, }); From 88689b304a0acf43f08c77805a84914b511cf0f6 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 13:47:32 -0700 Subject: [PATCH 07/23] Fixed issues and added reset button --- src/plugins/betterBanReasons/README.md | 7 --- src/plugins/betterBanReasons/index.tsx | 78 +++++++++++++------------ src/plugins/betterBanReasons/styles.css | 11 ++++ 3 files changed, 53 insertions(+), 43 deletions(-) create mode 100644 src/plugins/betterBanReasons/styles.css diff --git a/src/plugins/betterBanReasons/README.md b/src/plugins/betterBanReasons/README.md index 916f729869..1b6c7d08de 100644 --- a/src/plugins/betterBanReasons/README.md +++ b/src/plugins/betterBanReasons/README.md @@ -1,8 +1 @@ ### Create custom reasons to use in the Discord ban modal. - -![image](https://github.com/Vendicated/Vencord/assets/119569726/d0c1bd70-00b1-4786-a2f7-7db809f15ab0) -![image](https://github.com/Vendicated/Vencord/assets/119569726/411411f6-f2b7-4747-b6e7-4615116dcf22) - -I do not think that we're **easily** and **non-jankily** able to add the click functionality, so I didn't implement that. If anybody gets it working, shoot me a message on Discord. - -[Original plugin request](https://github.com/Vencord/plugin-requests/issues/607) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index ce8f38847b..a52d19b45e 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -4,59 +4,69 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ +import "./styles.css"; + import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { Button, Forms, TextInput, useEffect, useState } from "@webpack/common"; +import { Button, Forms, TextInput } from "@webpack/common"; + +const defaultReasons = [ + "Suspicious or spam account", + "Compromised or spam account", + "Breaking server rules", +]; function ReasonsComponent() { - const { reasons } = settings.use(["reasons"]); + const { reasons } = settings.use(["reasons"]); return ( - {reasons.map((reason, index) => ( + {reasons.map((reason: string, index: number) => (
{ - reasons[index] = value; - setReasons([...reasons]); + onChange={(v: string) => { + reasons[index] = v; + settings.store.reasons = [...reasons]; }} placeholder="Reason" />
))} - + +
); } @@ -65,11 +75,7 @@ const settings = definePluginSettings({ reasons: { description: "Your custom reasons", type: OptionType.COMPONENT, - default: [ - "Suspicious or spam account", - "Compromised or spam account", - "Breaking server rules", - ], + default: defaultReasons, component: ReasonsComponent, }, }); @@ -80,15 +86,15 @@ export default definePlugin({ authors: [Devs.Inbestigator], patches: [ { - find: 'username:"@".concat(_.default.getName', + find: "default.Messages.BAN_MULTIPLE_CONFIRM_TITLE", replacement: { - match: /U=\[([\s\S]*?)\]/, - replace: "U=$self.getReasons()", - }, - }, + match: /=\[([^\\]*?)\]/, + replace: "=$self.getReasons()" + } + } ], getReasons() { - return settings.store.reasons.map(reason => ( + return settings.store.reasons.map(reason => ( { name: reason, value: reason } )); }, diff --git a/src/plugins/betterBanReasons/styles.css b/src/plugins/betterBanReasons/styles.css new file mode 100644 index 0000000000..02fb4bbfa4 --- /dev/null +++ b/src/plugins/betterBanReasons/styles.css @@ -0,0 +1,11 @@ +.vc-bbr-reason-wrapper { + display: grid; + padding: 0; + padding-bottom: 0.5rem; + gap: 0.5rem; + grid-template-columns: 6fr 1fr; +} + +.vc-bbr-remove-button { + height: 100%; +} From ddd883b9886727294f8f2798e2c42231e0e6e394 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 14:29:28 -0700 Subject: [PATCH 08/23] i18n --- src/plugins/betterBanReasons/index.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index a52d19b45e..3a997a81a8 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -9,16 +9,16 @@ import "./styles.css"; import { definePluginSettings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { Button, Forms, TextInput } from "@webpack/common"; - -const defaultReasons = [ - "Suspicious or spam account", - "Compromised or spam account", - "Breaking server rules", -]; +import { Button, Forms, i18n, TextInput } from "@webpack/common"; function ReasonsComponent() { const { reasons } = settings.use(["reasons"]); + const defaultReasons = [ + i18n.Messages.BAN_REASON_OPTION_SPAM_ACCOUNT, + i18n.Messages.BAN_REASON_OPTION_HACKED_ACCOUNT, + i18n.Messages.BAN_REASON_OPTION_BREAKING_RULES + ]; + if (!reasons) settings.store.reasons = defaultReasons; return ( @@ -75,7 +75,6 @@ const settings = definePluginSettings({ reasons: { description: "Your custom reasons", type: OptionType.COMPONENT, - default: defaultReasons, component: ReasonsComponent, }, }); From 8208b528c08ea58cefb48a2f90215e471dee0080 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 16:12:21 -0700 Subject: [PATCH 09/23] Updated regex and added option to use other option by default --- src/plugins/betterBanReasons/index.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index 3a997a81a8..00eb3088f0 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -77,6 +77,10 @@ const settings = definePluginSettings({ type: OptionType.COMPONENT, component: ReasonsComponent, }, + otherOptionDefault: { + type: OptionType.BOOLEAN, + description: 'Shows a text input instead of a select menu by default. (Equivalent to clicking the "Other" option)' + } }); export default definePlugin({ @@ -86,10 +90,14 @@ export default definePlugin({ patches: [ { find: "default.Messages.BAN_MULTIPLE_CONFIRM_TITLE", - replacement: { - match: /=\[([^\\]*?)\]/, + replacement: [{ + match: /=\[[^]*?\]/, replace: "=$self.getReasons()" - } + }, + { + match: /useState\(0\)/g, + replace: "useState($self.isOtherDefault())" + }] } ], getReasons() { @@ -97,5 +105,8 @@ export default definePlugin({ { name: reason, value: reason } )); }, + isOtherDefault() { + return settings.store.otherOptionDefault ? 1 : 0; + }, settings, }); From 7d0f92dfa540ffc341c4d35ce6abd35ee3b42917 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 16:19:02 -0700 Subject: [PATCH 10/23] Unglobalized second regex --- src/plugins/betterBanReasons/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index 00eb3088f0..3381c97fe2 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -95,7 +95,7 @@ export default definePlugin({ replace: "=$self.getReasons()" }, { - match: /useState\(0\)/g, + match: /useState\(0\)/, replace: "useState($self.isOtherDefault())" }] } From 43f43ab2c5e8380605141e174ed5f8c88ebffa4e Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 16:22:42 -0700 Subject: [PATCH 11/23] Updated descriptions --- src/plugins/betterBanReasons/README.md | 3 ++- src/plugins/betterBanReasons/index.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/betterBanReasons/README.md b/src/plugins/betterBanReasons/README.md index 1b6c7d08de..296329a104 100644 --- a/src/plugins/betterBanReasons/README.md +++ b/src/plugins/betterBanReasons/README.md @@ -1 +1,2 @@ -### Create custom reasons to use in the Discord ban modal. +* Create custom reasons to use in the Discord ban modal. +* Show a text input by default instead of the options diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index 3381c97fe2..dc5cfc55ca 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -85,7 +85,7 @@ const settings = definePluginSettings({ export default definePlugin({ name: "BetterBanReasons", - description: "Create custom reasons to use in the Discord ban modal.", + description: "Create custom reasons to use in the Discord ban modal, and/or show a text input by default instead of the options.", authors: [Devs.Inbestigator], patches: [ { From ebb416019831682e12e7285c499b06ba90a7fe78 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 16:42:28 -0700 Subject: [PATCH 12/23] Made it display the defaults if custom options aren't defined --- src/plugins/betterBanReasons/index.tsx | 37 +++++++++----------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index dc5cfc55ca..ce456db8a1 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -13,12 +13,6 @@ import { Button, Forms, i18n, TextInput } from "@webpack/common"; function ReasonsComponent() { const { reasons } = settings.use(["reasons"]); - const defaultReasons = [ - i18n.Messages.BAN_REASON_OPTION_SPAM_ACCOUNT, - i18n.Messages.BAN_REASON_OPTION_HACKED_ACCOUNT, - i18n.Messages.BAN_REASON_OPTION_BREAKING_RULES - ]; - if (!reasons) settings.store.reasons = defaultReasons; return ( @@ -48,25 +42,14 @@ function ReasonsComponent() { ))} -
{ + reasons.push(""); + settings.store.reasons = [...reasons]; + }} > - -
+ Add new +
); } @@ -101,7 +84,11 @@ export default definePlugin({ } ], getReasons() { - return settings.store.reasons.map(reason => ( + return (settings.store.reasons.length() ? settings.store.reasons : [ + i18n.Messages.BAN_REASON_OPTION_SPAM_ACCOUNT, + i18n.Messages.BAN_REASON_OPTION_HACKED_ACCOUNT, + i18n.Messages.BAN_REASON_OPTION_BREAKING_RULES + ]).map((reason: string) => ( { name: reason, value: reason } )); }, From 767ce54d8f1607079401ef9dcf306994356567e0 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 16:58:35 -0700 Subject: [PATCH 13/23] Fixed bug --- src/plugins/betterBanReasons/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index ce456db8a1..3da7a36403 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -58,6 +58,7 @@ const settings = definePluginSettings({ reasons: { description: "Your custom reasons", type: OptionType.COMPONENT, + default: [], component: ReasonsComponent, }, otherOptionDefault: { @@ -84,7 +85,7 @@ export default definePlugin({ } ], getReasons() { - return (settings.store.reasons.length() ? settings.store.reasons : [ + return (settings.store.reasons.length ? settings.store.reasons : [ i18n.Messages.BAN_REASON_OPTION_SPAM_ACCOUNT, i18n.Messages.BAN_REASON_OPTION_HACKED_ACCOUNT, i18n.Messages.BAN_REASON_OPTION_BREAKING_RULES From 5b70fa355745ff9e9d1a245d582d8c0277148025 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Sun, 9 Jun 2024 16:59:58 -0700 Subject: [PATCH 14/23] Renamed otherOptionDefault -> textInputDefault --- src/plugins/betterBanReasons/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index 3da7a36403..fcc7dc56fd 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -61,7 +61,7 @@ const settings = definePluginSettings({ default: [], component: ReasonsComponent, }, - otherOptionDefault: { + textInputDefault: { type: OptionType.BOOLEAN, description: 'Shows a text input instead of a select menu by default. (Equivalent to clicking the "Other" option)' } @@ -94,7 +94,7 @@ export default definePlugin({ )); }, isOtherDefault() { - return settings.store.otherOptionDefault ? 1 : 0; + return settings.store.textInputDefault ? 1 : 0; }, settings, }); From 098e636b66b3f3b291ce64825ea45c27964ea0e8 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Thu, 20 Jun 2024 17:28:29 -0700 Subject: [PATCH 15/23] Updated regex (was broken) --- src/plugins/betterBanReasons/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index fcc7dc56fd..2ae8516bf7 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -73,7 +73,7 @@ export default definePlugin({ authors: [Devs.Inbestigator], patches: [ { - find: "default.Messages.BAN_MULTIPLE_CONFIRM_TITLE", + find: "Messages.BAN_MULTIPLE_CONFIRM_TITLE", replacement: [{ match: /=\[[^]*?\]/, replace: "=$self.getReasons()" From f84099ab2dcc2e876b7ccaee09a469566d59a1c7 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Thu, 27 Jun 2024 11:46:00 -0700 Subject: [PATCH 16/23] Fixed regexes and readme --- src/plugins/betterBanReasons/README.md | 6 ++++++ src/plugins/betterBanReasons/index.tsx | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/plugins/betterBanReasons/README.md b/src/plugins/betterBanReasons/README.md index 296329a104..eafc32c50b 100644 --- a/src/plugins/betterBanReasons/README.md +++ b/src/plugins/betterBanReasons/README.md @@ -1,2 +1,8 @@ +# BetterBanReasons + * Create custom reasons to use in the Discord ban modal. * Show a text input by default instead of the options + +![image](https://github.com/Vendicated/Vencord/assets/119569726/6227586b-43a2-4b05-9945-85995c3cb513) + +![image](https://github.com/Vendicated/Vencord/assets/119569726/4aaaf5f1-6dc4-4844-b4a9-9b23cfb739e2) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index 2ae8516bf7..2720b504c4 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -75,12 +75,12 @@ export default definePlugin({ { find: "Messages.BAN_MULTIPLE_CONFIRM_TITLE", replacement: [{ - match: /=\[[^]*?\]/, - replace: "=$self.getReasons()" + match: /\[\{name:\i\.\i\.Messages\.BAN_REASON_OPTION_SPAM_ACCOUNT.+?\}\]/, + replace: "$self.getReasons()" }, { - match: /useState\(0\)/, - replace: "useState($self.isOtherDefault())" + match: /useState\(0\)(?=.{0,100}targetUserId:)/, + replace: "useState($self.isOtherDefault())$2" }] } ], From cabf4280136c577d5497b679dd192c3d80e60c22 Mon Sep 17 00:00:00 2001 From: Inbestigator Date: Thu, 27 Jun 2024 11:55:06 -0700 Subject: [PATCH 17/23] Oopsy in the replace --- src/plugins/betterBanReasons/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index 2720b504c4..8a59406bef 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -80,7 +80,7 @@ export default definePlugin({ }, { match: /useState\(0\)(?=.{0,100}targetUserId:)/, - replace: "useState($self.isOtherDefault())$2" + replace: "useState($self.isOtherDefault())" }] } ], From 48b497436c18999b92e036c20243ce794c4abf2c Mon Sep 17 00:00:00 2001 From: Inbestigator <119569726+Inbestigator@users.noreply.github.com> Date: Thu, 27 Jun 2024 16:47:57 -0700 Subject: [PATCH 18/23] Update src/plugins/betterBanReasons/index.tsx Co-authored-by: vee --- src/plugins/betterBanReasons/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/betterBanReasons/index.tsx b/src/plugins/betterBanReasons/index.tsx index 8a59406bef..1c7e6869eb 100644 --- a/src/plugins/betterBanReasons/index.tsx +++ b/src/plugins/betterBanReasons/index.tsx @@ -44,8 +44,7 @@ function ReasonsComponent() { ))}