guildinfo: make clan info stylized to how it looks in client

This commit is contained in:
Cynthia Foxwell 2024-08-19 22:19:34 -06:00
parent acd29ae5f5
commit ce849c6a37
2 changed files with 20 additions and 16 deletions

View file

@ -84,7 +84,15 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
game = await hf.bot.requestHandler.request("GET", APIEndpoints.APPLICATION_RPC(id), false); game = await hf.bot.requestHandler.request("GET", APIEndpoints.APPLICATION_RPC(id), false);
} }
return `${game.name} (\`${id}\`)`; let out = `${game.name} (\`${id}\`)`;
if (clan.game_activity[id]?.level > 1) {
out = `:fire: ${out}`;
} else {
out = `${Icons.blank} ${out}`;
}
return out;
}) })
); );
@ -105,8 +113,14 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
} }
clanEmbed = { clanEmbed = {
title: _guild != null ? "Clan data" : clan.name, color: parseInt(clan.brand_color_primary.replace("#", "0x")),
description: clan.description ?? "*No description*", title: _guild == null ? clan.name : null,
author: {
name: clan.tag,
},
description: `-# :video_game:${ClanPlaystyle[clan.playstyle] ?? "Unknown"}${
clan.wildcard_descriptors.length > 0 ? ` \u2022 **${clan.wildcard_descriptors.join(", ")}**` : ""
}\n\n${clan.description ?? "*No description*"}`,
fields: [ fields: [
!_guild && { !_guild && {
name: "Member Count", name: "Member Count",
@ -118,16 +132,6 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
value: clan.tag, value: clan.tag,
inline: true, inline: true,
}, },
{
name: "Playstyle",
value: ClanPlaystyle[clan.playstyle] ?? `<unknown value: ${clan.playstyle}>`,
inline: true,
},
clan.wildcard_descriptors.length > 0 && {
name: "Descriptors",
value: `**${clan.wildcard_descriptors.join(", ")}**`,
inline: true,
},
clan.search_terms.length > 0 && { clan.search_terms.length > 0 && {
name: "Interests/Topics/Traits", name: "Interests/Topics/Traits",
value: termLines.join("\n"), value: termLines.join("\n"),
@ -135,7 +139,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
}, },
games.length > 0 && { games.length > 0 && {
name: "Associated Games", name: "Associated Games",
value: `- ${games.join("\n- ")}`, value: `${games.join("\n")}`,
inline: false, inline: false,
}, },
{ {
@ -155,7 +159,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
if (clan.badge_hash) { if (clan.badge_hash) {
const url = CDNEndpoints.CLAN_BADGE(clan.id, clan.badge_hash); const url = CDNEndpoints.CLAN_BADGE(clan.id, clan.badge_hash);
images.push(`[Badge](${url})`); images.push(`[Badge](${url})`);
clanEmbed.thumbnail = {url}; clanEmbed.author.icon_url = url;
} }
if (clan.banner_hash) { if (clan.banner_hash) {
const url = CDNEndpoints.CLAN_BANNER(clan.id, clan.banner_hash); const url = CDNEndpoints.CLAN_BANNER(clan.id, clan.banner_hash);

View file

@ -391,7 +391,7 @@ userinfo.callback = async function (msg, line) {
clanData && { clanData && {
name: "Clan", name: "Clan",
value: `${clanData.name} (\`${user.clan.identity_guild_id}\`)\n-# :video_game:${ value: `${clanData.name} (\`${user.clan.identity_guild_id}\`)\n-# :video_game:${
ClanPlaystyle[clanData.playstyle] ClanPlaystyle[clanData.playstyle] ?? "Unknown"
}${clanData.wildcard_descriptors.length > 0 ? ` \u2022 **${clanData.wildcard_descriptors.join(", ")}**` : ""}`, }${clanData.wildcard_descriptors.length > 0 ? ` \u2022 **${clanData.wildcard_descriptors.join(", ")}**` : ""}`,
inline: true, inline: true,
}, },