From 4b66c4e72edd35de7f4d79a32a44a332c143a9cf Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 11 Sep 2024 19:16:28 -0400 Subject: [PATCH] Discord Reverted The Sound Stuff --- src/equicordplugins/customSounds/index.tsx | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/equicordplugins/customSounds/index.tsx b/src/equicordplugins/customSounds/index.tsx index 816f078d..c910cd10 100644 --- a/src/equicordplugins/customSounds/index.tsx +++ b/src/equicordplugins/customSounds/index.tsx @@ -10,7 +10,7 @@ import { DataStore } from "@api/index"; import { definePluginSettings } from "@api/Settings"; import { Devs, EquicordDevs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; -import { Alerts, React } from "@webpack/common"; +import { React } from "@webpack/common"; import { SoundOverrideComponent } from "./components/SoundOverrideComponent"; import { makeEmptyOverride, SoundOverride, soundTypes } from "./types"; @@ -55,12 +55,12 @@ export default definePlugin({ patches: [ // sound class { - find: '"_ensureAudioPromise"', + find: 'Error("could not play audio")', replacement: [ // override URL { - match: /\i\([0-9]+\)\(.{1,20}(\i),"\.mp3"\)/, - replace: "$self.findOverride($1)?.url || $&" + match: /(?<=new Audio;\i\.src=)\i\([0-9]+\)\(.{0,20}\(this\.name,"\.mp3"\)/, + replace: "$self.findOverride(this.name)?.url || $&" }, // override volume { @@ -81,19 +81,6 @@ export default definePlugin({ settings, findOverride, isOverriden, - afterSave() { - Alerts.show({ - title: "Restart required", - body: ( - <> -
CustomSounds requires a restart for settings to activate.
- > - ), - confirmText: "Restart now", - cancelText: "Later!", - onConfirm: () => location.reload() - }); - }, async start() { overrides = await DataStore.get(OVERRIDES_KEY) ?? {}; for (const type of soundTypes)