From 6547cc10f7f515652de6513326342ea3e87535ba Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 17 May 2024 04:34:50 -0300 Subject: [PATCH] FakeNitro: Fix attempting to bypass unicode emojis Closes #2470 --- src/plugins/fakeNitro/index.tsx | 6 +++--- src/webpack/common/types/stores.d.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/fakeNitro/index.tsx b/src/plugins/fakeNitro/index.tsx index 65cae375..9c8af1e7 100644 --- a/src/plugins/fakeNitro/index.tsx +++ b/src/plugins/fakeNitro/index.tsx @@ -25,7 +25,7 @@ import { Logger } from "@utils/Logger"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack"; import { Alerts, ChannelStore, DraftType, EmojiStore, FluxDispatcher, Forms, IconUtils, lodash, Parser, PermissionsBits, PermissionStore, UploadHandler, UserSettingsActionCreators, UserStore } from "@webpack/common"; -import type { CustomEmoji } from "@webpack/types"; +import type { Emoji } from "@webpack/types"; import type { Message } from "discord-types/general"; import { applyPalette, GIFEncoder, quantize } from "gifenc"; import type { ReactElement, ReactNode } from "react"; @@ -812,8 +812,8 @@ export default definePlugin({ UploadHandler.promptToUpload([file], ChannelStore.getChannel(channelId), DraftType.ChannelMessage); }, - canUseEmote(e: CustomEmoji, channelId: string) { - if (e.require_colons === false) return true; + canUseEmote(e: Emoji, channelId: string) { + if (e.type === "UNICODE") return true; if (e.available === false) return false; const isUnusableRoleSubEmoji = RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmojiOriginal ?? RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmoji; diff --git a/src/webpack/common/types/stores.d.ts b/src/webpack/common/types/stores.d.ts index 27715b5e..059924f5 100644 --- a/src/webpack/common/types/stores.d.ts +++ b/src/webpack/common/types/stores.d.ts @@ -63,7 +63,7 @@ export interface CustomEmoji { originalName?: string; require_colons: boolean; roles: string[]; - url: string; + type: "GUILD_EMOJI"; } export interface UnicodeEmoji { @@ -75,6 +75,7 @@ export interface UnicodeEmoji { }; index: number; surrogates: string; + type: "UNICODE"; uniqueName: string; useSpriteSheet: boolean; get allNamesString(): string;