From faf6cd8ed9d93886b81327924f88090db81208e7 Mon Sep 17 00:00:00 2001 From: Rico040 <93081680+Rico040@users.noreply.github.com> Date: Thu, 6 Jun 2024 19:34:48 +1000 Subject: [PATCH] yet another wip upload --- plugins/action-sheet-finder/manifest.json | 18 +++++ plugins/action-sheet-finder/src/index.tsx | 24 ++++++ plugins/sticker-utils/manifest.json | 14 ++++ plugins/sticker-utils/src/index.tsx | 89 +++++++++++++++++++++++ 4 files changed, 145 insertions(+) create mode 100644 plugins/action-sheet-finder/manifest.json create mode 100644 plugins/action-sheet-finder/src/index.tsx create mode 100644 plugins/sticker-utils/manifest.json create mode 100644 plugins/sticker-utils/src/index.tsx diff --git a/plugins/action-sheet-finder/manifest.json b/plugins/action-sheet-finder/manifest.json new file mode 100644 index 0000000..c696c2f --- /dev/null +++ b/plugins/action-sheet-finder/manifest.json @@ -0,0 +1,18 @@ +{ + "name": "ActionSheetFinder", + "description": "Port of Enmity plugin.", + "authors": [ + { + "name": "Rico040", + "id": "619474349845643275" + }, + { + "name": "byeoon", + "id": "1167275288036655133" + } + ], + "main": "src/index.tsx", + "vendetta": { + "icon": "ic_search" + } +} \ No newline at end of file diff --git a/plugins/action-sheet-finder/src/index.tsx b/plugins/action-sheet-finder/src/index.tsx new file mode 100644 index 0000000..28e31a7 --- /dev/null +++ b/plugins/action-sheet-finder/src/index.tsx @@ -0,0 +1,24 @@ +import { showToast } from "@vendetta/ui/toasts" +import { before } from '@vendetta/patcher'; +import { getAssetIDByName } from '@vendetta/ui/assets'; +import { findByProps } from "@vendetta/metro"; + +const LazyActionSheet = findByProps("openLazy", "hideActionSheet"); +let unpatchOpenLazy: () => boolean; + +function SheetOutput(text) { + console.log("[ActionSheetFinder] Found ActionSheet: " + text); + showToast("[ActionSheetFinder] Found ActionSheet: " + text, getAssetIDByName("Check")) +} + + +export default { + onLoad() { + console.log("[ActionSheetFinder] Hello world!") + unpatchOpenLazy = before('openLazy', LazyActionSheet, ([key]) => { + console.log(this) + return SheetOutput(key); + }); + }, + onUnload: unpatchOpenLazy +}; \ No newline at end of file diff --git a/plugins/sticker-utils/manifest.json b/plugins/sticker-utils/manifest.json new file mode 100644 index 0000000..2364866 --- /dev/null +++ b/plugins/sticker-utils/manifest.json @@ -0,0 +1,14 @@ +{ + "name": "StickerUtils", + "description": "i love discord!", + "authors": [ + { + "name": "sapphire", + "id": "757982547861962752" + } + ], + "main": "src/index.tsx", + "vendetta": { + "icon": "ic_sticker_24px" + } +} \ No newline at end of file diff --git a/plugins/sticker-utils/src/index.tsx b/plugins/sticker-utils/src/index.tsx new file mode 100644 index 0000000..c9c2cd4 --- /dev/null +++ b/plugins/sticker-utils/src/index.tsx @@ -0,0 +1,89 @@ +import { before } from "@vendetta/patcher" +import { find, findByProps, findByStoreName } from "@vendetta/metro" +import { findInReactTree } from "@vendetta/utils" +import { Button } from "@vendetta/ui/components" +import { showToast } from "@vendetta/ui/toasts" +import { getAssetIDByName } from "@vendetta/ui/assets" +import { clipboard } from "@vendetta/metro/common" + +type Sticker = { + id: string + name: string + tags: string + type: number + format_type: number + description: string + asset: string + available: boolean + guild_id: string +} + +const GuildStore = findByStoreName("GuildStore") +const UserSettingsProtoStore = findByStoreName("UserSettingsProtoStore") +const ActionSheet = findByProps("ActionSheet")?.ActionSheet ?? find(m => m?.render?.name === "ActionSheet") +const { hideActionSheet } = findByProps("hideActionSheet") +const { downloadMediaAsset } = findByProps("downloadMediaAsset") +const StickerUtils = findByProps("favoriteSticker", "unfavoriteSticker") + +const style = { marginBottom: 10 } + +const unpatch = before("render", ActionSheet, ([props]) => { + const guh = findInReactTree(props, x => Array.isArray(x?.children)) + const sticker = findInReactTree(props, x => typeof x?.sticker === "object" && x?.sticker?.hasOwnProperty("guild_id"))?.sticker as Sticker + const favoritedStickers = UserSettingsProtoStore.frecencyWithoutFetchingLatest?.favoriteStickers?.stickerIds as Array + if (!guh || !sticker) return + const isFavorited = !!favoritedStickers?.find((s: string) => s === sticker.id) + const stickerUrl = `https://discord.com/stickers/${sticker.id}.png` + // replaces HUGE get nitro button, wow! + guh.children[1] = <> + { Object.values(GuildStore.getGuilds()).find((x: any) => x.id === sticker.guild_id) && +