clean up my shitcode

Co-authored-by: ImBanana - Elad <eladtairo@gmail.com>
This commit is contained in:
byeoon 2025-02-05 08:36:51 -05:00 committed by GitHub
parent 113bd7c236
commit 06bf35d640
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,18 +103,13 @@ function buildMenuItem(stickerId: string) {
const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => { const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => {
const { favoriteableId, favoriteableType } = props ?? {}; const { favoriteableId, favoriteableType } = props ?? {};
if (!favoriteableId) return; if (!favoriteableId) return;
const menuItem = (() => { if (favoriteableType != "sticker") return;
switch (favoriteableType) {
case "sticker":
const sticker = props.message.stickerItems.find(s => s.id === favoriteableId);
if (sticker?.format_type === 3) return;
return buildMenuItem("Sticker", () => fetchSticker(favoriteableId)); const sticker = props.message.stickerItems.find(s => s.id === favoriteableId);
} if (sticker?.format_type === 3) return;
})();
if (menuItem) const menuItem = buildMenuItem("Sticker", () => fetchSticker(favoriteableId);
findGroupChildrenByChildId("devmode-copy-id", children, true)?.push(menuItem); findGroupChildrenByChildId("devmode-copy-id", children, true)?.push(menuItem);
}; };
const expressionPickerPatch: NavContextMenuPatchCallback = (children, props: { target: HTMLElement; }) => { const expressionPickerPatch: NavContextMenuPatchCallback = (children, props: { target: HTMLElement; }) => {