From 7845af0802de70700c5855ea687a67b6dd85b6cc Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 27 Oct 2023 19:55:39 -0300 Subject: [PATCH] Remove hacks to support no longer active versions of Discord --- src/webpack/common/stores.ts | 11 ++--------- src/webpack/common/utils.ts | 9 +-------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/src/webpack/common/stores.ts b/src/webpack/common/stores.ts index c4ebd4a95..d10b18664 100644 --- a/src/webpack/common/stores.ts +++ b/src/webpack/common/stores.ts @@ -20,7 +20,7 @@ import { proxyLazy } from "@utils/lazy"; import type * as Stores from "discord-types/stores"; // eslint-disable-next-line path-alias/no-relative -import { filters, findByCode, findByProps, findByPropsLazy, mapMangledModuleLazy } from "../webpack"; +import { filters, findByProps, findByPropsLazy, mapMangledModuleLazy } from "../webpack"; import { waitForStore } from "./internal"; import * as t from "./types/stores"; @@ -84,14 +84,7 @@ export const useStateFromStores: ( idk?: any, isEqual?: (old: T, newer: T) => boolean ) => T - // FIXME: hack to support old stable and new canary - = proxyLazy(() => { - try { - return findByProps("useStateFromStores").useStateFromStores; - } catch { - return findByCode('("useStateFromStores")'); - } - }); + = proxyLazy(() => findByProps("useStateFromStores").useStateFromStores); waitForStore("DraftStore", s => DraftStore = s); waitForStore("UserStore", s => UserStore = s); diff --git a/src/webpack/common/utils.ts b/src/webpack/common/utils.ts index 6de57c92d..04df3c07d 100644 --- a/src/webpack/common/utils.ts +++ b/src/webpack/common/utils.ts @@ -136,11 +136,4 @@ waitFor("parseTopic", m => Parser = m); export let SettingsRouter: any; waitFor(["open", "saveAccountChanges"], m => SettingsRouter = m); -// FIXME: hack to support old stable and new canary -export const PermissionsBits: t.PermissionsBits = proxyLazy(() => { - try { - return find(m => m.Permissions?.ADMINISTRATOR).Permissions; - } catch { - return find(m => typeof m.ADMINISTRATOR === "bigint"); - } -}); +export const PermissionsBits: t.PermissionsBits = proxyLazy(() => find(m => typeof m.Permissions?.ADMINISTRATOR === "bigint").Permissions);