guildinfo: try 2

This commit is contained in:
Cynthia Foxwell 2025-04-21 17:32:48 -06:00
parent 58183ab07a
commit fb1f549be5
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -71,8 +71,9 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
_guild = await getGuild(snowflake, nolocal);
id = snowflake;
let clan;
try {
let clan = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(snowflake), true);
clan = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(snowflake), true);
if (!clan) {
if (guild.profile) {
clan = guild.profile;
@ -93,6 +94,9 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
}
}
}
} catch {
// noop
}
if (clan) {
const images = [];
@ -165,9 +169,12 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
author: {
name: clan.tag,
},
description: `-# :video_game:${ClanPlaystyle[clan.playstyle] ?? "Unknown"}${
description:
clan.playstyle || clan.wildcard_descriptors
? `-# :video_game:${ClanPlaystyle[clan.playstyle] ?? "Unknown"}${
clan.wildcard_descriptors.length > 0 ? ` \u2022 **${clan.wildcard_descriptors.join(", ")}**` : ""
}\n\n${clan.description ?? "*No description*"}`,
}\n\n${clan.description ?? "*No description*"}`
: clan.description ?? "*No description*",
fields: [
!_guild && {
name: "Member Count",
@ -196,9 +203,7 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
},
clan.brand_color_primary && {
name: "Banner/Brand Colors",
value: `${clan.brand_color_primary}${
clan.brand_color_secondary ? `, ${clan.brand_color_secondary}` : ""
}`,
value: `${clan.brand_color_primary}${clan.brand_color_secondary ? `, ${clan.brand_color_secondary}` : ""}`,
inline: true,
},
].filter((x) => !!x),
@ -225,9 +230,6 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
});
}
}
} catch {
// noop
}
}
if (!_guild) {