guildinfo: guh
This commit is contained in:
parent
93810518ab
commit
58055605fc
1 changed files with 15 additions and 23 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue