diff --git a/js/lanyard.eggsy.d.ts b/js/lanyard.eggsy.d.ts index a916549..5f8af20 100644 --- a/js/lanyard.eggsy.d.ts +++ b/js/lanyard.eggsy.d.ts @@ -37,6 +37,12 @@ declare interface LanyardAPI { type: number; application_id: string; state: string; + // for hang statuses. + emoji?: { + id: string; + name: string; + animated: boolean; + }; details?: string; assets?: { small_image: string; diff --git a/js/lanyard.ts b/js/lanyard.ts index 42aff22..ba74388 100644 --- a/js/lanyard.ts +++ b/js/lanyard.ts @@ -212,7 +212,11 @@ async function setActivityBigImage(): Promise { data: { activities, spotify }, } = await fetchResponse(USERID); const mostRecent = activities.filter((m: { type: number; }) => m.type !== 4).shift(); - if (!mostRecent?.assets?.large_image) { + if (mostRecent?.emoji && !mostRecent?.assets?.large_image) { + bigImage.style.display = "block"; + bigImage.src = `https://cdn.discordapp.com/emojis/${mostRecent.emoji.id}.webp?quality=lossless`; + bigImage.title = mostRecent.emoji.name; + } else if (!mostRecent?.assets?.large_image) { bigImage.style.display = "none"; return; } else { @@ -232,6 +236,8 @@ async function setActivityBigImage(): Promise { bigImage.title = mostRecent.assets.large_text; } } + + async function setActivitySmallImage(): Promise { const { data: { activities },