FakeNitro: Fix attempting to bypass unicode emojis

Closes #2470
main
Nuckyz 4 months ago
parent ffe1d7cc4d
commit 6547cc10f7
No known key found for this signature in database
GPG Key ID: 440BF8296E1C4AD9

@ -25,7 +25,7 @@ import { Logger } from "@utils/Logger";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy, findStoreLazy, proxyLazyWebpack } from "@webpack"; 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 { 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 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";
@ -812,8 +812,8 @@ export default definePlugin({
UploadHandler.promptToUpload([file], ChannelStore.getChannel(channelId), DraftType.ChannelMessage); UploadHandler.promptToUpload([file], ChannelStore.getChannel(channelId), DraftType.ChannelMessage);
}, },
canUseEmote(e: CustomEmoji, channelId: string) { canUseEmote(e: Emoji, channelId: string) {
if (e.require_colons === false) return true; if (e.type === "UNICODE") return true;
if (e.available === false) return false; if (e.available === false) return false;
const isUnusableRoleSubEmoji = RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmojiOriginal ?? RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmoji; const isUnusableRoleSubEmoji = RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmojiOriginal ?? RoleSubscriptionEmojiUtils.isUnusableRoleSubscriptionEmoji;

@ -63,7 +63,7 @@ export interface CustomEmoji {
originalName?: string; originalName?: string;
require_colons: boolean; require_colons: boolean;
roles: string[]; roles: string[];
url: string; type: "GUILD_EMOJI";
} }
export interface UnicodeEmoji { export interface UnicodeEmoji {
@ -75,6 +75,7 @@ export interface UnicodeEmoji {
}; };
index: number; index: number;
surrogates: string; surrogates: string;
type: "UNICODE";
uniqueName: string; uniqueName: string;
useSpriteSheet: boolean; useSpriteSheet: boolean;
get allNamesString(): string; get allNamesString(): string;

Loading…
Cancel
Save