From 9faa1331da67b76a50697d61c00f72f5601b8b4a Mon Sep 17 00:00:00 2001 From: philipbry <81459908+philipbry@users.noreply.github.com> Date: Wed, 6 Dec 2023 23:15:34 +0100 Subject: [PATCH] new plugin: notificationVolume (#1992) Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Co-authored-by: V --- src/plugins/notificationVolume/README.md | 3 ++ src/plugins/notificationVolume/index.ts | 35 ++++++++++++++++++++++++ src/utils/constants.ts | 4 +++ 3 files changed, 42 insertions(+) create mode 100644 src/plugins/notificationVolume/README.md create mode 100644 src/plugins/notificationVolume/index.ts diff --git a/src/plugins/notificationVolume/README.md b/src/plugins/notificationVolume/README.md new file mode 100644 index 000000000..05e5af4e2 --- /dev/null +++ b/src/plugins/notificationVolume/README.md @@ -0,0 +1,3 @@ +# NotificationVolume + +Set a separate volume for notifications and in-app sounds (e.g. messages, call sound, mute/unmute) helping your ears stay healthy for many years to come. diff --git a/src/plugins/notificationVolume/index.ts b/src/plugins/notificationVolume/index.ts new file mode 100644 index 000000000..50eabee73 --- /dev/null +++ b/src/plugins/notificationVolume/index.ts @@ -0,0 +1,35 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2023 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"; + +const settings = definePluginSettings({ + notificationVolume: { + type: OptionType.SLIDER, + description: "Notification volume", + markers: [0, 25, 50, 75, 100], + default: 100, + stickToMarkers: false + } +}); + +export default definePlugin({ + name: "NotificationVolume", + description: "Save your ears and set a separate volume for notifications and in-app sounds", + authors: [Devs.philipbry], + settings, + patches: [ + { + find: "_ensureAudio(){", + replacement: { + match: /onloadeddata=\(\)=>\{.\.volume=/, + replace: "$&$self.settings.store.notificationVolume/100*" + }, + }, + ], +}); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index daa4a74dc..1c477b124 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -387,6 +387,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "ant0n", id: 145224646868860928n }, + philipbry: { + name: "philipbry", + id: 554994003318276106n + }, Korbo: { name: "Korbo", id: 455856406420258827n