From 97214e58b6cecdffe19a93bf975cb35188d06efe Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Tue, 13 Aug 2024 23:51:16 -0600 Subject: [PATCH] userinfo: extended clan info --- src/modules/utility/userinfo.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/modules/utility/userinfo.js b/src/modules/utility/userinfo.js index 96e913d..ca9c09d 100644 --- a/src/modules/utility/userinfo.js +++ b/src/modules/utility/userinfo.js @@ -6,6 +6,7 @@ const { ApplicationFlags, BadgeURLs, CDNEndpoints, + ClanPlaystyle, UserFlags, } = require("@util/dconstants.js"); const { @@ -246,9 +247,14 @@ userinfo.callback = async function (msg, line) { if (botDeleted) { descLines.push("*This bot's application has been deleted*"); } + let clanData; if (user.clan) { // TODO: badge emojis via color aproximation of the default presets - descLines.push(`**${user.clan.tag}** (\`${user.clan.identity_guild_id}\`)`); + descLines.push(`**${user.clan.tag}**`); + + clanData = await hf.bot.requestHandler + .request("GET", APIEndpoints.CLAN(user.clan.identity_guild_id), true) + .catch(() => {}); } if (anyMember) { @@ -317,6 +323,12 @@ userinfo.callback = async function (msg, line) { } (\`${user.avatar_decoration_data.sku_id}\`)\n[Image](${decorationUrl})`, inline: true, }, + clanData && { + name: "Clan", + value: `${clanData.name} (\`${user.clan.identity_guild_id}\`)\n-# :video_game:${ + ClanPlaystyle[clanData.playstyle] + }${clanData.wildcard_descriptors.length > 0 ? ` \u2022 **${clanData.wildcard_descriptors.join(", ")}**` : ""}`, + }, member?.roles?.length > 0 && { name: "Roles", value: member.roles