Get icon of current game from Member object
Hello! I've been working on a project that uses Discord.js to grab the current activity of a Guild Member and display it as an SVG. I've got Custom Statuses and Rich Presence working, but I don't know how to get a URL to the icon of a non-Rich Presence application like Baldur's Gate 3. This is the Activity object associated with it:
My understanding based on this discussion is that Discord maintains a list of detectable games with associated icon IDs. The URL they reference (https://discord.com/api/v9/applications/detectable) doesn't appear to contain icon data, though because it contains entries for relatively recent games I'm sure it's being updated. Am I overlooking something, is there another solution, or is this just no longer possible?
7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPunfortunately doesn't seem to be available to bots, unless I'm being foolish
hi, you can construct the avatar url by using
tho this would not be an svg
I have the avatar, banner, custom emoji, and rich presence assets working fine (https://github.com/TetraTsunami/discord-github-preview), but I appreciate the advice :)
I hope this might illustrate my issue. In my profile, I can see the logo for Cookie Clicker when I have cookie clicker open. The image URL according to devtools is https://cdn.discordapp.com/app-icons/1124351789895004280/a0820416954a79e24dfe9d9b7d31369b.webp?size=80&keep_aspect_ratio=false. But the API response for the activity is
As you can see, that icon URL is nowhere to be found. The application ID matches, but I don't know how to find "a0820416954a79e24dfe9d9b7d31369b" to construct the full image URL. Format doesn't matter because I'm embedding them anyway.
found a solution from the Discord Developers server (https://discord.com/channels/613425648685547541/1183059417755815956), I need to make a request to https://discord.com/api/v10/applications/<app_id>/rpc and the icon hash is there