From 63387a48ee1862ac192966a99db8036368b9a08f Mon Sep 17 00:00:00 2001 From: Supertiger Date: Fri, 12 May 2023 01:58:53 +0100 Subject: [PATCH] silentMessageToggle: Add setting to disable auto disable (#1062) Co-authored-by: V --- src/plugins/silentMessageToggle.tsx | 9 +++++++-- src/utils/constants.ts | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/plugins/silentMessageToggle.tsx b/src/plugins/silentMessageToggle.tsx index f5be5ceb3..22d2c0541 100644 --- a/src/plugins/silentMessageToggle.tsx +++ b/src/plugins/silentMessageToggle.tsx @@ -33,6 +33,11 @@ const settings = definePluginSettings({ onChange(newValue: boolean) { if (newValue === false) lastState = false; } + }, + autoDisable: { + type: OptionType.BOOLEAN, + description: "Automatically disable the silent message toggle again after sending one", + default: true } }); @@ -51,7 +56,7 @@ function SilentMessageToggle(chatBoxProps: { React.useEffect(() => { const listener: SendListener = (_, message) => { if (enabled) { - setEnabledValue(false); + if (settings.store.autoDisable) setEnabledValue(false); if (!message.content.startsWith("@silent ")) message.content = "@silent " + message.content; } }; @@ -96,7 +101,7 @@ function SilentMessageToggle(chatBoxProps: { export default definePlugin({ name: "SilentMessageToggle", - authors: [Devs.Nuckyz], + authors: [Devs.Nuckyz, Devs.CatNoir], description: "Adds a button to the chat bar to toggle sending a silent message.", dependencies: ["MessageEventsAPI"], diff --git a/src/utils/constants.ts b/src/utils/constants.ts index a10a0a58b..b53c1d7c0 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -286,5 +286,9 @@ export const Devs = /* #__PURE__*/ Object.freeze({ carince: { name: "carince", id: 818323528755314698n + }, + CatNoir: { + name: "CatNoir", + id: 260371016348336128n } });