mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 15:35:11 +00:00
Actually works now, nice.
This commit is contained in:
parent
dc0aef360b
commit
2c47b13fe4
1 changed files with 38 additions and 33 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue