FakeNitro Fix

This commit is contained in:
thororen1234 2024-12-08 21:48:47 -05:00
parent 7a0b240500
commit ab07047b66

View file

@ -17,7 +17,7 @@
*/ */
import { addPreEditListener, addPreSendListener, removePreEditListener, removePreSendListener } from "@api/MessageEvents"; 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 { Devs } from "@utils/constants";
import { ApngBlendOp, ApngDisposeOp, importApngJs } from "@utils/dependencies"; import { ApngBlendOp, ApngDisposeOp, importApngJs } from "@utils/dependencies";
import { getCurrentGuild, getEmojiURL } from "@utils/discord"; import { getCurrentGuild, getEmojiURL } from "@utils/discord";
@ -30,6 +30,14 @@ import type { Message } from "discord-types/general";
import { applyPalette, GIFEncoder, quantize } from "gifenc"; import { applyPalette, GIFEncoder, quantize } from "gifenc";
import type { ReactElement, ReactNode } from "react"; 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 { const StickerStore = findStoreLazy("StickersStore") as {
getPremiumPacks(): StickerPack[]; getPremiumPacks(): StickerPack[];
getAllGuildStickers(): Map<string, Sticker[]>; getAllGuildStickers(): Map<string, Sticker[]>;
@ -412,22 +420,17 @@ export default definePlugin({
}, },
get canUseEmotes() { get canUseEmotes() {
// @ts-ignore return (premiumType) > 0;
return (UserStore?.getCurrentUser()?._realPremiumType ?? UserStore?.getCurrentUser().premiumType ?? 0) > 0;
}, },
get canUseStickers() { get canUseStickers() {
// @ts-ignore return (premiumType) > 1;
return (UserStore?.getCurrentUser()?._realPremiumType ?? UserStore.getCurrentUser().premiumType ?? 0) > 1;
}, },
handleProtoChange(proto: any, user: any) { handleProtoChange(proto: any, user: any) {
try { try {
if (proto == null || typeof proto === "string") return; if (proto == null || typeof proto === "string") return;
// @ts-ignore
const premiumType: number = user?._realPremiumType ?? user?.premium_type ?? UserStore?.getCurrentUser()?.premiumType ?? 0;
if (premiumType !== 2) { if (premiumType !== 2) {
proto.appearance ??= AppearanceSettingsActionCreators.create(); proto.appearance ??= AppearanceSettingsActionCreators.create();
@ -456,8 +459,6 @@ export default definePlugin({
}, },
handleGradientThemeSelect(backgroundGradientPresetId: number | undefined, theme: number, original: () => void) { 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 (premiumType === 2 || backgroundGradientPresetId == null) return original();
if (!PreloadedUserSettingsActionCreators || !AppearanceSettingsActionCreators || !ClientThemeSettingsActionsCreators || !BINARY_READ_OPTIONS) return; if (!PreloadedUserSettingsActionCreators || !AppearanceSettingsActionCreators || !ClientThemeSettingsActionsCreators || !BINARY_READ_OPTIONS) return;
@ -917,7 +918,6 @@ export default definePlugin({
} }
if (s.enableEmojiBypass) { if (s.enableEmojiBypass) {
for (const emoji of messageObj.validNonShortcutEmojis) { for (const emoji of messageObj.validNonShortcutEmojis) {
if (this.canUseEmote(emoji, channelId)) continue; if (this.canUseEmote(emoji, channelId)) continue;