diff --git a/src/equicordplugins/keyboardSounds/index.ts b/src/equicordplugins/keyboardSounds/index.ts index 1e6dceb2..9c5bba22 100644 --- a/src/equicordplugins/keyboardSounds/index.ts +++ b/src/equicordplugins/keyboardSounds/index.ts @@ -16,7 +16,6 @@ * along with this program. If not, see . */ -import { Settings } from "@api/Settings"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; @@ -28,19 +27,6 @@ let sounds = { backspace }; -if (Settings.plugins.KeyboardSounds.enabled) { - click1 = new Audio("https://github.com/HypedDomi/Vencord-Plugins/raw/main/Keyboard-Sounds/sounds/click1.wav"); - click2 = new Audio("https://github.com/HypedDomi/Vencord-Plugins/raw/main/Keyboard-Sounds/sounds/click2.wav"); - click3 = new Audio("https://github.com/HypedDomi/Vencord-Plugins/raw/main/Keyboard-Sounds/sounds/click3.wav"); - backspace = new Audio("https://github.com/HypedDomi/Vencord-Plugins/raw/main/Keyboard-Sounds/sounds/backspace.wav"); - sounds = { - click1, - click2, - click3, - backspace, - }; -} - const ignoredKeys = ["CapsLock", "ShiftLeft", "ShiftRight", "ControlLeft", "ControlRight", "AltLeft", "AltRight", "MetaLeft", "MetaRight", "ArrowUp", "ArrowRight", "ArrowLeft", "ArrowDown", "MediaPlayPause", "MediaStop", "MediaTrackNext", "MediaTrackPrevious", "MediaSelect", "MediaEject", "MediaVolumeUp", "MediaVolumeDown", "AudioVolumeUp", "AudioVolumeDown"]; const keydown = (e: KeyboardEvent) => { @@ -60,7 +46,19 @@ export default definePlugin({ name: "Keyboard Sounds", description: "Adds the Opera GX Keyboard Sounds to Discord", authors: [Devs.HypedDomi], - start: () => document.addEventListener("keydown", keydown), + start: () => { + click1 = new Audio("https://github.com/HypedDomi/Vencord-Plugins/raw/main/Keyboard-Sounds/sounds/click1.wav"); + click2 = new Audio("https://github.com/HypedDomi/Vencord-Plugins/raw/main/Keyboard-Sounds/sounds/click2.wav"); + click3 = new Audio("https://github.com/HypedDomi/Vencord-Plugins/raw/main/Keyboard-Sounds/sounds/click3.wav"); + backspace = new Audio("https://github.com/HypedDomi/Vencord-Plugins/raw/main/Keyboard-Sounds/sounds/backspace.wav"); + sounds = { + click1, + click2, + click3, + backspace, + }; + document.addEventListener("keydown", keydown); + }, stop: () => document.removeEventListener("keydown", keydown), options: { volume: {