Add option to hide Discord profile ith hideProfile=true

This commit is contained in:
brokiem
2022-11-27 13:43:48 +08:00
parent a00c26e237
commit 1830ff60b0
2 changed files with 13 additions and 2 deletions

View File

@@ -61,6 +61,10 @@ If you don't want people seeing the elapsed time on an activity, append the quer
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. 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___
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.
## ___Example URL and result___ ## ___Example URL and result___
``` ```

View File

@@ -15,6 +15,7 @@ type Parameters = {
hideStatus?: string; hideStatus?: string;
hideTimestamp?: string; hideTimestamp?: string;
hideBadges?: string; hideBadges?: string;
hideProfile?: string;
borderRadius?: string; borderRadius?: string;
idleMessage?: string; idleMessage?: string;
}; };
@@ -55,6 +56,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
hideStatus = "false", hideStatus = "false",
hideTimestamp = "false", hideTimestamp = "false",
hideBadges = "false", hideBadges = "false",
hideProfile = "false",
borderRadius = "10px", borderRadius = "10px",
idleMessage = "I'm not currently doing anything!"; idleMessage = "I'm not currently doing anything!";
@@ -65,6 +67,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
if (params.hideTimestamp === "true") hideTimestamp = "true"; if (params.hideTimestamp === "true") hideTimestamp = "true";
if (params.hideBadges === "true") hideBadges = "true"; if (params.hideBadges === "true") hideBadges = "true";
if (params.hideDiscrim === "true") discrim = "hide"; if (params.hideDiscrim === "true") discrim = "hide";
if (params.hideProfile === "true") hideProfile = "true";
if (params.theme === "light") { if (params.theme === "light") {
backgroundColor = "#eee"; backgroundColor = "#eee";
theme = "light"; theme = "light";
@@ -137,7 +140,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
<div xmlns="http://www.w3.org/1999/xhtml" style=" <div xmlns="http://www.w3.org/1999/xhtml" style="
position: absolute; position: absolute;
width: 400px; width: 400px;
height: 200px; height: ${hideProfile === "true" ? "120px" : "200px"};
inset: 0; inset: 0;
background-color: #${backgroundColor}; background-color: #${backgroundColor};
color: ${theme === "dark" ? "#fff" : "#000"}; color: ${theme === "dark" ? "#fff" : "#000"};
@@ -148,6 +151,9 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
padding: 5px; padding: 5px;
border-radius: ${borderRadius}; border-radius: ${borderRadius};
"> ">
${
hideProfile === "true" ? "" : `
<div style=" <div style="
width: 400px; width: 400px;
height: 100px; height: 100px;
@@ -252,7 +258,8 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise<
</h1>` : `` </h1>` : ``
} }
</div> </div>
</div> </div>`
}
${ ${
activity ? ` activity ? `