From 3e0355cb531c622c18c6bdfc3105572b3446be92 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 5 Oct 2022 14:25:37 +0200 Subject: [PATCH] Fix consoleShortcuts for web --- src/plugins/consoleShortcuts.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/consoleShortcuts.ts b/src/plugins/consoleShortcuts.ts index 4bc39c5d5..4b33d572a 100644 --- a/src/plugins/consoleShortcuts.ts +++ b/src/plugins/consoleShortcuts.ts @@ -1,6 +1,10 @@ import { Devs } from "../utils/constants"; import definePlugin from "../utils/types"; +const WEB_ONLY = (f: string) => () => { + throw new Error(`'${f}' is Discord Desktop only.`); +}; + export default definePlugin({ name: "ConsoleShortcuts", description: "Adds shorter Aliases for many things on the window. Run `shortcutList` for a list.", @@ -8,8 +12,8 @@ export default definePlugin({ getShortcuts() { return { - toClip: window.DiscordNative.clipboard.copy, - fromClip: window.DiscordNative.clipboard.read, + toClip: IS_WEB ? WEB_ONLY("toClip") : window.DiscordNative.clipboard.copy, + fromClip: IS_WEB ? WEB_ONLY("fromClip") : window.DiscordNative.clipboard.read, wp: Vencord.Webpack, wpc: Vencord.Webpack.wreq.c, wreq: Vencord.Webpack.wreq, @@ -22,7 +26,7 @@ export default definePlugin({ Settings: Vencord.Settings, Api: Vencord.Api, reload: () => location.reload(), - restart: () => window.DiscordNative.app.relaunch() + restart: IS_WEB ? WEB_ONLY("restart") : window.DiscordNative.app.relaunch }; },