Skip to content

Commit

Permalink
Add Hang Status image
Browse files Browse the repository at this point in the history
  • Loading branch information
DexrnZacAttack authored May 2, 2024
2 parents 120731e + 9151b1d commit 6089a8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions js/lanyard.eggsy.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion js/lanyard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ async function setActivityBigImage(): Promise<void> {
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 {
Expand All @@ -232,6 +236,8 @@ async function setActivityBigImage(): Promise<void> {
bigImage.title = mostRecent.assets.large_text;
}
}


async function setActivitySmallImage(): Promise<void> {
const {
data: { activities },
Expand Down

0 comments on commit 6089a8b

Please sign in to comment.