userinfo: extended clan info

This commit is contained in:
Cynthia Foxwell 2024-08-13 23:51:16 -06:00
parent 147ea8997a
commit 97214e58b6

View file

@ -6,6 +6,7 @@ const {
ApplicationFlags, ApplicationFlags,
BadgeURLs, BadgeURLs,
CDNEndpoints, CDNEndpoints,
ClanPlaystyle,
UserFlags, UserFlags,
} = require("@util/dconstants.js"); } = require("@util/dconstants.js");
const { const {
@ -246,9 +247,14 @@ userinfo.callback = async function (msg, line) {
if (botDeleted) { if (botDeleted) {
descLines.push("*This bot's application has been deleted*"); descLines.push("*This bot's application has been deleted*");
} }
let clanData;
if (user.clan) { if (user.clan) {
// TODO: badge emojis via color aproximation of the default presets // 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) { if (anyMember) {
@ -317,6 +323,12 @@ userinfo.callback = async function (msg, line) {
} (\`${user.avatar_decoration_data.sku_id}\`)\n[Image](${decorationUrl})`, } (\`${user.avatar_decoration_data.sku_id}\`)\n[Image](${decorationUrl})`,
inline: true, 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 && { member?.roles?.length > 0 && {
name: "Roles", name: "Roles",
value: member.roles value: member.roles