/* * Vencord, a Discord client mod * Copyright (c) 2024 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ import "./style.css"; import { definePluginSettings } from "@api/Settings"; import { FFmpeg } from "@ffmpeg/ffmpeg"; import { Devs, EquicordDevs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { Channel } from "@vencord/discord-types"; import { React } from "@webpack/common"; import { Packs, PickerContent, PickerHeader, PickerSidebar, Wrapper } from "./components"; import { getStickerPack, getStickerPackMetas } from "./stickers"; import { StickerPack, StickerPackMeta } from "./types"; import { cl, FFmpegStateContext, loadFFmpeg } from "./utils"; export const settings = definePluginSettings({ promptToUpload: { type: OptionType.BOOLEAN, description: "Inserts the sticker into your chatbar instead of sending immediately", default: false }, packs: { type: OptionType.COMPONENT, description: "Packs", component: Packs } }); export default definePlugin({ name: "MoreStickers", description: "Adds sticker packs from other social media platforms. (e.g. LINE)", tags: ["Chat", "Emotes", "Media"], authors: [EquicordDevs.Leko, Devs.Arjix], settings, patches: [ { find: "#{intl::STICKER_BUTTON_LABEL}", replacement: [{ match: /(children:\(0,\i\.jsx\)\()(.{0,10})({className:\i\(\)\(\i\.\i,\i\.\i)/, replace: "$1arguments[0]?.stickersType?$self.stickerButton:$2$3" }, { match: /(\i=)((\i\.useCallback\(\(\)=>\{\(.*?\)\().*?\.STICKER,(\i.{0,25}\]\)))/, replace: '$1arguments[0]?.stickersType?$3"stickers+",$4:$2' }, { match: /(\i)=((\i)===\i\.\i\.STICKER)/, replace: "$1=arguments[0].stickersType?($3===arguments[0].stickersType):($2)" }] }, { find: ".GIFT_PROMOTION]).", replacement: [ { match: /(?<=(,\i\.stickers\?\.button.{0,50}\i\.push\(\(.{0,100})\},"sticker"\)\))/, replace: "$1,stickersType:\"stickers+\"},\"stickers+\"))" }, ] }, { find: "#{intl::EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL}", replacement: [ { match: /(?<=(\i)\?(\(.{0,15}\))\((\i),\{.{0,150}(\i)===\i\.\i\.STICKER,.{0,150}children:(.{0,30}\.\i,children:.{0,25})\}\)\}\):null)/, replace: ',vcStickers=$1?$2($3,{id:"stickers+-picker-tab","aria-controls":"more-stickers-picker-tab-panel","aria-selected":$4==="stickers+",isActive:$4==="stickers+",autoFocus:true,viewType:"stickers+",children:$5+"+"})}):null' }, { match: /children:\[\i,\i(?=.{0,150}\.SOUNDBOARD)/g, replace: "$&,vcStickers" }, { match: /:null,((.{1,200})===.{1,30}\.STICKER&&\w+\?(\([^()]{1,10}\)).{1,15}?(\{.*?,onSelectSticker:.*?\})\):null)/, replace: ':null,$2==="stickers+"?$3($self.moreStickersComponent,$4):null,$1' } ] }, ], stickerButton({ innerClassName, isActive, onClick }) { return ( ); }, moreStickersComponent({ channel, closePopout }: { channel: Channel, closePopout: () => void; }) { if (FFmpegStateContext === undefined) { return