guildinfo: guh

This commit is contained in:
Cynthia Foxwell 2025-04-21 17:42:33 -06:00
parent 93810518ab
commit 58055605fc
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -71,31 +71,23 @@ guildinfo.callback = async function (msg, line, args, {nolocal, debug}) {
_guild = await getGuild(snowflake, nolocal);
id = snowflake;
let clan;
try {
clan = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(snowflake), true);
if (!clan) {
if (_guild?.profile) {
clan = _guild?.profile;
} else {
const verif = await hf.bot.requestHandler.request(
"GET",
`${APIEndpoints.GUILD_MEMBER_VERIFICATION(snowflake)}?with_guild=true`,
true
);
if (verif?.profile) {
clan = verif.profile;
} else if (_guild?.vanityURL) {
const invite = await hf.bot.requestHandler.request(
"GET",
`${APIEndpoints.INVITE(_guild.vanityURL)}?with_counts=true&with_expiration=true`
);
if (invite?.profile) clan = invite.profile;
}
let clan = await hf.bot.requestHandler.request("GET", APIEndpoints.CLAN(snowflake), true).catch(() => {});
if (!clan) {
if (_guild?.profile) {
clan = _guild?.profile;
} else {
const verif = await hf.bot.requestHandler
.request("GET", `${APIEndpoints.GUILD_MEMBER_VERIFICATION(snowflake)}?with_guild=true`, true)
.catch(() => {});
if (verif?.profile) {
clan = verif.profile;
} else if (_guild?.vanityURL) {
const invite = await hf.bot.requestHandler
.request("GET", `${APIEndpoints.INVITE(_guild.vanityURL)}?with_counts=true&with_expiration=true`)
.catch(() => {});
if (invite?.profile) clan = invite.profile;
}
}
} catch {
// noop
}
if (clan) {