fix things as needed

This commit is contained in:
byeoon 2025-01-31 08:25:27 -05:00
parent e04032eb09
commit eeb8750f94

View file

@ -36,14 +36,7 @@ interface Sticker {
type: number; type: number;
} }
interface Emoji { type Data = Sticker;
t: "Emoji";
id: string;
name: string;
isAnimated: boolean;
}
type Data = Emoji | Sticker;
const StickerExt = [, "png", "png", "json", "gif"] as const; const StickerExt = [, "png", "png", "json", "gif"] as const;
@ -51,7 +44,7 @@ function getUrl(data: Data) {
if (data.t === "Sticker") if (data.t === "Sticker")
return `https:${window.GLOBAL_ENV.MEDIA_PROXY_ENDPOINT}/stickers/${data.id}.${StickerExt[data.format_type]}?size=2048&lossless=true`; return `https:${window.GLOBAL_ENV.MEDIA_PROXY_ENDPOINT}/stickers/${data.id}.${StickerExt[data.format_type]}?size=2048&lossless=true`;
return "oops Couldnt get it sorry boss"; return "";
} }
async function fetchSticker(id: string) { async function fetchSticker(id: string) {
@ -83,7 +76,6 @@ function buildMenuItem(type: "Sticker", fetchData: () => Promisable<Omit<Sticker
const res = await fetchData(); const res = await fetchData();
const data = { t: type, ...res } as Sticker; const data = { t: type, ...res } as Sticker;
const url = getUrl(data); const url = getUrl(data);
console.log("URL: " + url + "\n" + "Data: " + data);
Toasts.show({ Toasts.show({
message: "Link to sticker copied!", message: "Link to sticker copied!",
type: Toasts.Type.SUCCESS, type: Toasts.Type.SUCCESS,