From ab07047b66138c0d5132418ffa0e31262bd6ca02 Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 8 Dec 2024 21:48:47 -0500 Subject: [PATCH] FakeNitro Fix --- src/plugins/fakeNitro/index.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index 40e42f3a..6fe8adbf 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -17,7 +17,7 @@ */ import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "@api/MessageEvents"; -import { definePluginSettings } from "@api/Settings"; +import { definePluginSettings, Settings } from "@api/Settings"; import { Devs } from "@utils/constants"; import { ApngBlendOp, ApngDisposeOp, importApngJs } from "@utils/dependencies"; import { getCurrentGuild, getEmojiURL } from "@utils/discord"; @@ -30,6 +30,14 @@ import type { Message } from "discord-types/general"; import { applyPalette, GIFEncoder, quantize } from "gifenc"; import type { ReactElement, ReactNode } from "react"; +let premiumType; +if (Settings.plugins.NoNitroUpsell.enabled) { + // @ts-ignore + premiumType = UserStore?.getCurrentUser()?._realPremiumType ?? UserStore?.getCurrentUser()?.premiumType ?? 0; +} else { + premiumType = UserStore?.getCurrentUser()?.premiumType ?? 0; +} + const StickerStore = findStoreLazy("StickersStore") as { getPremiumPacks(): StickerPack[]; getAllGuildStickers(): Map; @@ -412,22 +420,17 @@ export default definePlugin({ }, get canUseEmotes() { - // @ts-ignore - return (UserStore?.getCurrentUser()?._realPremiumType ?? UserStore?.getCurrentUser().premiumType ?? 0) > 0; + return (premiumType) > 0; }, get canUseStickers() { - // @ts-ignore - return (UserStore?.getCurrentUser()?._realPremiumType ?? UserStore.getCurrentUser().premiumType ?? 0) > 1; + return (premiumType) > 1; }, handleProtoChange(proto: any, user: any) { try { if (proto == null || typeof proto === "string") return; - // @ts-ignore - const premiumType: number = user?._realPremiumType ?? user?.premium_type ?? UserStore?.getCurrentUser()?.premiumType ?? 0; - if (premiumType !== 2) { proto.appearance ??= AppearanceSettingsActionCreators.create(); @@ -456,8 +459,6 @@ export default definePlugin({ }, handleGradientThemeSelect(backgroundGradientPresetId: number | undefined, theme: number, original: () => void) { - // @ts-ignore - const premiumType = UserStore?.getCurrentUser()?._realPremiumType ?? UserStore?.getCurrentUser()?.premiumType ?? 0; if (premiumType === 2 || backgroundGradientPresetId == null) return original(); if (!PreloadedUserSettingsActionCreators || !AppearanceSettingsActionCreators || !ClientThemeSettingsActionsCreators || !BINARY_READ_OPTIONS) return; @@ -917,7 +918,6 @@ export default definePlugin({ } if (s.enableEmojiBypass) { - for (const emoji of messageObj.validNonShortcutEmojis) { if (this.canUseEmote(emoji, channelId)) continue;