diff --git a/package.json b/package.json index ba6e845ef..da8a013df 100644 --- a/package.json +++ b/package.json @@ -48,18 +48,18 @@ "@vap/shiki": "0.10.5", "fflate": "^0.8.2", "gifenc": "github:mattdesl/gifenc#64842fca317b112a8590f8fef2bf3825da8f6fe3", - "jsqr": "1.4.0", "idb": "8.0.3", + "jsqr": "1.4.0", "monaco-editor": "^0.52.2", "nanoid": "^5.1.5", + "openai": "^4.30.0", "socket.io": "^4.8.1", "usercss-meta": "^0.12.0", - "openai": "^4.30.0", "virtual-merge": "^1.0.1" }, "devDependencies": { - "@stylistic/eslint-plugin": "^4.2.0", "@electron/asar": "^3.2.10", + "@stylistic/eslint-plugin": "^4.2.0", "@types/chrome": "^0.0.312", "@types/diff": "^7.0.2", "@types/lodash": "^4.17.14", @@ -94,7 +94,7 @@ "zip-local": "^0.3.5", "zustand": "^3.7.2" }, - "packageManager": "pnpm@10.4.1", + "packageManager": "pnpm@10.14.0", "pnpm": { "patchedDependencies": { "eslint@9.20.1": "patches/eslint@9.20.1.patch", diff --git a/src/equicordplugins/copyStickerLinks/index.tsx b/src/equicordplugins/copyStickerLinks/index.tsx index ac4a43d4c..13454c13d 100644 --- a/src/equicordplugins/copyStickerLinks/index.tsx +++ b/src/equicordplugins/copyStickerLinks/index.tsx @@ -18,7 +18,7 @@ interface Sticker { type: number; } -const StickerExt = ["png", "png", "json", "gif"] as const; +const StickerExt = [, "png", "png", "json", "gif"] as const; function getUrl(data: Sticker) { if (data.format_type === 4) @@ -32,39 +32,6 @@ function buildMenuItem(Sticker, fetchData: () => Promisable>) <> - { - const res = await fetchData(); - const data = { t: Sticker, ...res } as Sticker; - const url = getUrl(data[0]); - copyWithToast(url, "Link copied!"); - } - } - /> - - { - const res = await fetchData(); - const data = { t: Sticker, ...res } as Sticker; - const url = getUrl(data[0]); - VencordNative.native.openExternal(url); - } - } - /> - - ); -} - -function buildMenuExpression(Sticker, fetchData: () => Promisable>) { - return ( - <> - Promisable + Promisable { const { favoriteableId, favoriteableType } = props ?? {}; if (!favoriteableId) return; + const menuItem = (() => { - const sticker = props.message.stickerItems.find(s => s.id === favoriteableId); - if (sticker?.format_type === 3) return; switch (favoriteableType) { case "sticker": - return buildMenuItem("Sticker", () => props.message.stickerItems); + const sticker = props.message.stickerItems.find(s => s.id === favoriteableId); + if (!sticker?.format_type) return; + return buildMenuItem("Sticker", () => props.message.stickerItems[0]); } })(); @@ -116,7 +85,12 @@ const expressionPickerPatch: NavContextMenuPatchCallback = (children, props: { t if (!props.target.className?.includes("lottieCanvas")) { const stickerCache = StickerStore.getStickerById(id); if (stickerCache) { - children.push(buildMenuExpression("Sticker", () => stickerCache)); + const stickerInfo = { + format_type: stickerCache.format_type, + id: stickerCache.id, + type: stickerCache.type + }; + children.push(buildMenuItem("Sticker", () => stickerInfo)); } } };