silentMessageToggle: Add setting to disable auto disable (#1062)
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
parent
3bb68467bb
commit
63387a48ee
@ -33,6 +33,11 @@ const settings = definePluginSettings({
|
|||||||
onChange(newValue: boolean) {
|
onChange(newValue: boolean) {
|
||||||
if (newValue === false) lastState = false;
|
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(() => {
|
React.useEffect(() => {
|
||||||
const listener: SendListener = (_, message) => {
|
const listener: SendListener = (_, message) => {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
setEnabledValue(false);
|
if (settings.store.autoDisable) setEnabledValue(false);
|
||||||
if (!message.content.startsWith("@silent ")) message.content = "@silent " + message.content;
|
if (!message.content.startsWith("@silent ")) message.content = "@silent " + message.content;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -96,7 +101,7 @@ function SilentMessageToggle(chatBoxProps: {
|
|||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "SilentMessageToggle",
|
name: "SilentMessageToggle",
|
||||||
authors: [Devs.Nuckyz],
|
authors: [Devs.Nuckyz, Devs.CatNoir],
|
||||||
description: "Adds a button to the chat bar to toggle sending a silent message.",
|
description: "Adds a button to the chat bar to toggle sending a silent message.",
|
||||||
dependencies: ["MessageEventsAPI"],
|
dependencies: ["MessageEventsAPI"],
|
||||||
|
|
||||||
|
@ -286,5 +286,9 @@ export const Devs = /* #__PURE__*/ Object.freeze({
|
|||||||
carince: {
|
carince: {
|
||||||
name: "carince",
|
name: "carince",
|
||||||
id: 818323528755314698n
|
id: 818323528755314698n
|
||||||
|
},
|
||||||
|
CatNoir: {
|
||||||
|
name: "CatNoir",
|
||||||
|
id: 260371016348336128n
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user