userinfo: add decoration field

This commit is contained in:
Cynthia Foxwell 2024-08-13 23:39:04 -06:00
parent 7d413d38ff
commit 8dd9cde7d7

View file

@ -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 shared = Array.from(hf.bot.guilds.values()).filter((g) => g.members.get(id) != null);
const descLines = []; const descLines = [];
@ -300,6 +308,15 @@ userinfo.callback = async function (msg, line) {
value: member.nick, value: member.nick,
inline: true, 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 && { member?.roles?.length > 0 && {
name: "Roles", name: "Roles",
value: member.roles value: member.roles