From 8dd9cde7d7ebdbec752c0727febb6417736d0911 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Tue, 13 Aug 2024 23:39:04 -0600 Subject: [PATCH] userinfo: add decoration field --- src/modules/utility/userinfo.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/modules/utility/userinfo.js b/src/modules/utility/userinfo.js index 6710b1b..176b051 100644 --- a/src/modules/utility/userinfo.js +++ b/src/modules/utility/userinfo.js @@ -229,6 +229,14 @@ userinfo.callback = async function (msg, line) { } } + let decoration, decorationUrl; + if (user.avatar_decoration_data) { + decoration = await hf.bot.requestHandler + .request("GET", APIEndpoints.STORE_PUBLISHED_LISTING(user.avatar_decoration_data.sku_id), true) + .catch(() => {}); + decorationUrl = CDNEndpoints.AVATAR_DECORATION(user.avatar_decoration_data.asset); + } + const shared = Array.from(hf.bot.guilds.values()).filter((g) => g.members.get(id) != null); const descLines = []; @@ -300,6 +308,15 @@ userinfo.callback = async function (msg, line) { value: member.nick, inline: true, }, + user.avatar_decoration_data && { + name: `Avatar Decoration ${user.avatar_decoration_data.asset.startsWith("a_") ? "(Animated)" : ""}`, + value: `${ + decoration?.sku + ? `[${decoration?.sku?.name}](https://discord.com/shop#itemSkuId=${user.avatar_decoration_data.sku_id})` + : "Unknown" + } (\`${user.avatar_decoration_data.sku_id}\`)\n[Image](${decorationUrl})`, + inline: true, + }, member?.roles?.length > 0 && { name: "Roles", value: member.roles