Actually works now, nice.

This commit is contained in:
byeoon 2025-01-30 23:22:28 -05:00
parent dc0aef360b
commit 2c47b13fe4

View file

@ -72,44 +72,49 @@ async function fetchSticker(id: string) {
function buildMenuItem(type: "Sticker", fetchData: () => Promisable<Omit<Sticker, "t">>) { function buildMenuItem(type: "Sticker", fetchData: () => Promisable<Omit<Sticker, "t">>) {
return ( return (
<Menu.MenuItem <>
id="copystickerurl" <Menu.MenuSeparator></Menu.MenuSeparator>
key="copystickerurl"
label={"Copy Sticker Link"} <Menu.MenuItem
action={async () => { id="copystickerurl"
const res = await fetchData(); key="copystickerurl"
const data = { t: type, ...res } as Sticker; label={"Copy Sticker Link"}
const url = getUrl(data); action={async () => {
console.log("URL: " + url + "\n" + "Data: " + data); const res = await fetchData();
Toasts.show({ const data = { t: type, ...res } as Sticker;
message: "Link to sticker copied!", const url = getUrl(data);
type: Toasts.Type.SUCCESS, console.log("URL: " + url + "\n" + "Data: " + data);
id: Toasts.genId() Toasts.show({
}); message: "Link to sticker copied!",
Clipboard.copy(url); type: Toasts.Type.SUCCESS,
} id: Toasts.genId()
} });
/> Clipboard.copy(url);
}
}
/>
<Menu.MenuItem
id="openstickerlink"
key="openstickerlink"
label={"Open Sticker Link"}
action={async () => {
const res = await fetchData();
const data = { t: type, ...res } as Sticker;
const url = getUrl(data);
VencordNative.native.openExternal(url);
}
}
/>
</>
); );
} }
/*
<Menu.MenuItem
id="openstickerlink"
key="openstickerlink"
label={"Open Sticker Link"}
action={async () => {
const res = await fetchData();
const data = { t: type, ...res } as Sticker;
const url = getUrl(data);
VencordNative.native.openExternal(url);
}
}
/>
*/
const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => { const messageContextMenuPatch: NavContextMenuPatchCallback = (children, props) => {
const { favoriteableId, itemHref, itemSrc, favoriteableType } = props ?? {}; const { favoriteableId, favoriteableType } = props ?? {};
if (!favoriteableId) return; if (!favoriteableId) return;
const menuItem = (() => { const menuItem = (() => {
switch (favoriteableType) { switch (favoriteableType) {