refactor: change variable hideClanTag to hideClan

This commit is contained in:
Hexagonn
2024-09-24 15:34:17 +07:00
parent 9b817b7a31
commit 24b496ffe4
2 changed files with 28 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
<!-- markdownlint-disable -->
# lanyard-profile-readme
🏷️ Utilize Lanyard to display your Discord Presence in your GitHub Profile
@@ -25,66 +26,67 @@ When others click it, they will be directed to your actual Discord profile. Neat
There are a few options to customize this display using query parameters:
### ___Theme___
### **_Theme_**
Append the query param `theme=:theme` to the end of the URL, replacing `:theme` with either `light` or `dark`. This will change the background and the font colors, but the background can be overridden with the ___Background Color___ parameter.
Append the query param `theme=:theme` to the end of the URL, replacing `:theme` with either `light` or `dark`. This will change the background and the font colors, but the background can be overridden with the **_Background Color_** parameter.
### ___Background Color___
### **_Background Color_**
Append the query param `bg=:color` to the end of the URL, replacing `:color` with a hex color of your choice (omit the #)
### ___Border Radius___
### **_Border Radius_**
Append the query param `borderRadius=:radius` to the end of the URL, replacing `:radius` with a radius of your choice. (default `10px`)
### ___Toggle Animated Avatar___
### **_Toggle Animated Avatar_**
If you have an animated avatar, append the query param `animated=:bool` to the end of the URL, replacing `:bool` with `true` or `false`. This is set to `true` by default.
### ___Custom Idle Message___
### **_Custom Idle Message_**
If you don't want the default "`I'm not currently doing anything!`" as your idle message, you can change it by appending `idleMessage=:yourmessage` to the end of the URL.
### ___Show Display Name___
### **_Show Display Name_**
If you'd like to show your global display name as well as your username, append the query param `showDisplayName=true` to the end of the URL. This is set to `false` by default.
### ___Hide Status___
### **_Hide Status_**
If you don't want people seeing your status, append the query param `hideStatus=true` to the end of the URL. Your status is shown by default if you have one.
### ___Hide Elapsed Time___
### **_Hide Elapsed Time_**
If you don't want people seeing the elapsed time on an activity, append the query param `hideTimestamp=true` to the end of the URL. Elapsed time is shown by default.
## ____Hide Clan Tag___
If you don't want people seeing your Clan Tag (formerly known as Guilds), append the query param `hideClanTag=true` to the end of the URL. Clan Tag is shown by default.
### **_Hide Clan Tag_**
### ___Hide Badges___
If you don't want people seeing your Clan Tag (formerly known as Guilds), append the query param `hideClan=true` to the end of the URL. Clan Tag is shown by default.
### **_Hide Badges_**
If you don't want people seeing the badges you have on Discord, append the query param `hideBadges=true` to the end of the URL. Badges are shown by default.
### ___Hide Profile___
### **_Hide Profile_**
If you don't want people seeing the profile you have on Discord, append the query param `hideProfile=true` to the end of the URL. Profile are shown by default.
### ___Hide Activity___
### **_Hide Activity_**
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___
### **_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___
### **_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 `,`.
### ___Hide Discriminator___ (DEPRECATED soon)
### **_Hide Discriminator_** (DEPRECATED soon)
If you don't want people seeing your discriminator (most likely for privacy reasons), append the query param `hideDiscrim=true` to the end of the URL. Your discriminator is shown by default.
## ___Example URL and result___
## **_Example URL and result_**
```
[![Discord Presence](https://lanyard-profile-readme.vercel.app/api/94490510688792576?theme=light&bg=809ecf&animated=false&hideDiscrim=true&borderRadius=30px&idleMessage=Probably%20doing%20something%20else...)](https://discord.com/users/94490510688792576)

View File

@@ -18,7 +18,7 @@ type Parameters = {
hideProfile?: string;
hideActivity?: string;
hideSpotify?: string;
hideClanTag?: string;
hideClan?: string;
ignoreAppId?: string;
showDisplayName?: string;
borderRadius?: string;
@@ -73,13 +73,13 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
let hideProfile = parseBool(params.hideProfile);
let hideActivity = params.hideActivity ?? "false";
let hideSpotify = parseBool(params.hideSpotify);
let hideClanTag = parseBool(params.hideClanTag);
let hideClan = parseBool(params.hideClan);
let ignoreAppId = parseAppId(params.ignoreAppId);
let hideDiscrim = parseBool(params.hideDiscrim);
let showDisplayName = parseBool(params.showDisplayName);
if (parseBool(params.hideDiscrim) || body.data.discord_user.discriminator === "0") hideDiscrim = true;
if (!body.data.discord_user.clan) hideClanTag = true;
if (!body.data.discord_user.clan) hideClan = true;
if (data.activities[0]?.emoji?.animated) statusExtension = "gif";
if (data.discord_user.avatar && data.discord_user.avatar.startsWith("a_")) avatarExtension = "gif";
if (params.animated === "false") avatarExtension = "webp";
@@ -242,7 +242,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
}
</h1>
${hideClanTag ? "" : `
${hideClan ? "" : `
<span style="
background-color: ${clanBackgroundColor};
border-radius: 0.375rem;