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