diff --git a/README.md b/README.md index 15f9922..7dba07b 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,10 @@ If you have an animated avatar, append the query param `animated=:bool` to the e 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. +### ___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. + ## ___Example URL and result___ ``` diff --git a/pages/api/[...id].ts b/pages/api/[...id].ts index bd56572..c7c7b67 100644 --- a/pages/api/[...id].ts +++ b/pages/api/[...id].ts @@ -30,7 +30,7 @@ export default async function handler( }) .catch((err) => { console.log(err); - res.send({ error: 'Please provide a valid Discord user ID!' }) + res.send({ error: `Something went wrong! If everything looks correct and this still occurs, please contact @cnraddd on Twitter.` }) }); let svg = await renderCard(lanyardData.data, params); diff --git a/src/renderCard.tsx b/src/renderCard.tsx index 8a564b6..fea4b6e 100644 --- a/src/renderCard.tsx +++ b/src/renderCard.tsx @@ -10,6 +10,7 @@ type Parameters = { bg?: string; animated?: string; hideDiscrim?: string; + hideStatus?: string; } const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise => { @@ -22,6 +23,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise< let backgroundColor: string = '1a1c1f'; let theme = 'dark'; let discrim = 'show'; + let hideStatus = 'false'; if(body.data.activities[0]){ if(body.data.activities[0].emoji && body.data.activities[0].emoji.animated === true) statusExtension = "gif"; @@ -42,6 +44,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise< theme = 'light'; } if(params.bg) backgroundColor = params.bg; + if(params.hideStatus === 'true') hideStatus = 'true'; switch(body.data.discord_status){ case "online": @@ -118,7 +121,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise< display: flex; flex-direction: row; position: relative; - top: ${userStatus.length > 0 ? "35%" : "50%"}; + top: ${userStatus.length > 0 && hideStatus !== "true" ? "35%" : "50%"}; transform: translate(0, -50%); height: 25px; "> @@ -149,7 +152,7 @@ const renderCard = async (body: LanyardTypes.Root, params: Parameters): Promise< - ${userStatus.length > 0 ? ` + ${userStatus.length > 0 && hideStatus !== "true" ? `

-

PLAYING A GAME...

+

PLAYING A GAME...

-

LISTENING NOW...

+

LISTENING NOW...