Quick Fix

This commit is contained in:
thororen1234 2024-07-13 00:11:16 -04:00
parent 1344d0a15f
commit 07759183a9

View file

@ -16,7 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
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: {