From ff58d1f8497b075f46e942af4d1466ce3a01e1e5 Mon Sep 17 00:00:00 2001 From: denshooter Date: Thu, 23 Apr 2026 23:06:27 +0200 Subject: [PATCH] fix: no broken game cover URLs for auto-detected games, improve gaming card contrast --- app/components/ActivityFeed.tsx | 8 +++---- discord-presence-bot/index.js | 40 ++++++++++++++++----------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/app/components/ActivityFeed.tsx b/app/components/ActivityFeed.tsx index 5910a49..c5c304d 100644 --- a/app/components/ActivityFeed.tsx +++ b/app/components/ActivityFeed.tsx @@ -165,10 +165,10 @@ export default function ActivityFeed({ )} {data?.gaming?.isPlaying && ( - +
- - {t("gaming")} + + {t("gaming")}
{data.gaming.image && ( @@ -178,7 +178,7 @@ export default function ActivityFeed({ )}

{data.gaming.name}

-

+

{getSafeGamingText(data.gaming.details, data.gaming.state, t("inGame"))}

diff --git a/discord-presence-bot/index.js b/discord-presence-bot/index.js index 9264a57..b2f15ef 100644 --- a/discord-presence-bot/index.js +++ b/discord-presence-bot/index.js @@ -41,28 +41,28 @@ function updatePresence(guild) { type: a.type, details: a.details || null, state: a.state || null, - assets: a.assets - ? { - large_image: a.assets.largeImage || null, - large_text: a.assets.largeText || null, - small_image: a.assets.smallImage || null, - small_text: a.assets.smallText || null, - } - : null, - timestamps: a.timestamps - ? { - start: a.timestamps.start?.toISOString() || null, - end: a.timestamps.end?.toISOString() || null, - } - : null, + image: null, + applicationId: a.applicationId || null, }; if (a.applicationId && a.assets?.largeImage) { - const imgId = a.assets.largeImage.startsWith("mp:external") - ? `https://media.discordapp.net/${a.assets.largeImage.replace("mp:", "")}` - : `https://cdn.discordapp.com/app-assets/${a.applicationId}/${a.assets.largeImage}.png`; - entry.image = imgId; - } else if (a.assets?.largeImage) { - entry.image = `https://cdn.discordapp.com/app-assets/0/${a.assets.largeImage}.png`; + const imgKey = a.assets.largeImage; + entry.image = imgKey.startsWith("mp:external") + ? `https://media.discordapp.net/${imgKey.replace("mp:", "")}` + : `https://cdn.discordapp.com/app-assets/${a.applicationId}/${imgKey}.png`; + } + if (a.assets) { + entry.assets = { + large_image: a.assets.largeImage || null, + large_text: a.assets.largeText || null, + small_image: a.assets.smallImage || null, + small_text: a.assets.smallText || null, + }; + } + if (a.timestamps) { + entry.timestamps = { + start: a.timestamps.start?.toISOString() || null, + end: a.timestamps.end?.toISOString() || null, + }; } return entry; })