Skip to content

Commit

Permalink
Merge pull request #56 from GravityScriptsV2/main
Browse files Browse the repository at this point in the history
feat: Implement #55
  • Loading branch information
cnrad committed Jun 9, 2024
2 parents 85af5a3 + db705bd commit c783ae1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ If you don't want people seeing the profile you have on Discord, append the quer

If you don't want people seeing the your activity, append the query param `hideActivity=true` to the end of the URL or use `hideActivity=whenNotUsed` to hide activity section when there's no activity to display. Activity are shown by default.

### ___Hide Spotify___

If you don't want people seeing your Spotify activity, append the query param `hideSpotify=true` to the end of the URL. Spotify activity is shown by default.

### ___Hide App by ID___

If you don't want display a specific application, append the query param `ignoreAppId=:app_id` to the end of the URL, IDs separate by `,`.
Expand Down
8 changes: 6 additions & 2 deletions src/renderCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Parameters = {
hideBadges?: string;
hideProfile?: string;
hideActivity?: string;
hideSpotify?: string;
ignoreAppId?: string;
showDisplayName?: string;
borderRadius?: string;
Expand Down Expand Up @@ -69,6 +70,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
let hideBadges = parseBool(params.hideBadges);
let hideProfile = parseBool(params.hideProfile);
let hideActivity = params.hideActivity ?? "false";
let hideSpotify = parseBool(params.hideSpotify);
let ignoreAppId = parseAppId(params.ignoreAppId);
let hideDiscrim = parseBool(params.hideDiscrim);
let showDisplayName = parseBool(params.showDisplayName);
Expand Down Expand Up @@ -136,6 +138,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
if (hideProfile) return "130";
if (hideActivity === "true") return "91";
if (hideActivity === "whenNotUsed" && !activity && !data.listening_to_spotify) return "91";
if (hideSpotify && data.listening_to_spotify) return "210";
return "210";
}

Expand All @@ -144,6 +147,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
if (hideProfile) return "120";
if (hideActivity === "true") return "81";
if (hideActivity === "whenNotUsed" && !activity && !data.listening_to_spotify) return "81";
if (hideSpotify && data.listening_to_spotify) return "200";
return "200";
}

Expand Down Expand Up @@ -412,7 +416,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
}
${
data.listening_to_spotify && !activity && data.activities[Object.keys(data.activities).length - 1].type === 2
data.listening_to_spotify && !activity && !hideSpotify && data.activities[Object.keys(data.activities).length - 1].type === 2
? `
<div style="
display: flex;
Expand Down Expand Up @@ -466,7 +470,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
` : ``
}
${
!activity && !data.listening_to_spotify && hideActivity === "false"
!activity && (!data.listening_to_spotify || hideSpotify) && hideActivity === "false"
? `<div style="
display: flex;
flex-direction: row;
Expand Down

0 comments on commit c783ae1

Please sign in to comment.