revert changes that broke the code

This commit is contained in:
byeoon 2025-02-06 21:59:27 -05:00
parent bb3f8bd20a
commit 0f61bca0c5

View file

@ -61,7 +61,7 @@ async function fetchSticker(id: string) {
return body as Sticker;
}
function buildMenuItem(stickerId: string) {
function buildMenuItem(type: "Sticker", fetchData: () => Promisable<Omit<Sticker, "t">>) {
return (
<>
<Menu.MenuSeparator></Menu.MenuSeparator>
@ -103,12 +103,17 @@ function buildMenuItem(stickerId: string) {
const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => {
const { favoriteableId, favoriteableType } = props ?? {};
if (!favoriteableId) return;
if (favoriteableType != "sticker") return;
const menuItem = (() => {
switch (favoriteableType) {
case "sticker":
const sticker = props.message.stickerItems.find(s => s.id === favoriteableId);
if (sticker?.format_type === 3) return;
const menuItem = buildMenuItem("Sticker", () => fetchSticker(favoriteableId);
return buildMenuItem("Sticker", () => fetchSticker(favoriteableId));
}
})();
if (menuItem)
findGroupChildrenByChildId("devmode-copy-id", children, true)?.push(menuItem);
};