From 06bf35d6404c153fd7f27d0ded5e3de5c2b299ea Mon Sep 17 00:00:00 2001 From: byeoon <47872200+byeoon@users.noreply.github.com> Date: Wed, 5 Feb 2025 08:36:51 -0500 Subject: [PATCH] clean up my shitcode Co-authored-by: ImBanana - Elad --- src/plugins/copyStickerLinks/index.tsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/plugins/copyStickerLinks/index.tsx b/src/plugins/copyStickerLinks/index.tsx index 666b4742f..3b369b90e 100644 --- a/src/plugins/copyStickerLinks/index.tsx +++ b/src/plugins/copyStickerLinks/index.tsx @@ -103,18 +103,13 @@ function buildMenuItem(stickerId: string) { const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => { const { favoriteableId, favoriteableType } = props ?? {}; if (!favoriteableId) return; - const menuItem = (() => { - switch (favoriteableType) { - case "sticker": - const sticker = props.message.stickerItems.find(s => s.id === favoriteableId); - if (sticker?.format_type === 3) return; + if (favoriteableType != "sticker") return; - return buildMenuItem("Sticker", () => fetchSticker(favoriteableId)); - } - })(); + const sticker = props.message.stickerItems.find(s => s.id === favoriteableId); + if (sticker?.format_type === 3) return; - if (menuItem) - findGroupChildrenByChildId("devmode-copy-id", children, true)?.push(menuItem); + const menuItem = buildMenuItem("Sticker", () => fetchSticker(favoriteableId); + findGroupChildrenByChildId("devmode-copy-id", children, true)?.push(menuItem); }; const expressionPickerPatch: NavContextMenuPatchCallback = (children, props: { target: HTMLElement; }) => {