silentMessageToggle: Add setting to disable auto disable (#1062)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Supertiger 2023-05-12 01:58:53 +01:00 committed by GitHub
parent 3bb68467bb
commit 63387a48ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

@ -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"],

@ -286,5 +286,9 @@ export const Devs = /* #__PURE__*/ Object.freeze({
carince: {
name: "carince",
id: 818323528755314698n
},
CatNoir: {
name: "CatNoir",
id: 260371016348336128n
}
});