utility.banner: guild banners exposed finally
This commit is contained in:
parent
39bd3f0a93
commit
ce884db8bf
1 changed files with 35 additions and 6 deletions
|
@ -1010,21 +1010,50 @@ banner.callback = async function (msg, line, [user], {server, guild}) {
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!userObj.banner) return "This user does not have a banner.";
|
let memberObj;
|
||||||
|
if (msg.guildID) {
|
||||||
|
memberObj = await hf.bot.requestHandler.request(
|
||||||
|
"GET",
|
||||||
|
`/guilds/${msg.guildID}/members/${id}`,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const url = `${BANNER_BASE}${userObj.id}/${userObj.banner}.${
|
if (!userObj.banner && !memberObj?.banner)
|
||||||
|
return "This user does not have a banner.";
|
||||||
|
|
||||||
|
const url =
|
||||||
|
userObj.banner &&
|
||||||
|
`${BANNER_BASE}${userObj.id}/${userObj.banner}.${
|
||||||
userObj.banner.startsWith("a_") ? "gif?size=4096&_=.gif" : "png?size=4096"
|
userObj.banner.startsWith("a_") ? "gif?size=4096&_=.gif" : "png?size=4096"
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
|
const guildUrl =
|
||||||
|
memberObj?.banner &&
|
||||||
|
`${CDN}guilds/${msg.guildID}/users/${userObj.id}/banners/${
|
||||||
|
memberObj.banner
|
||||||
|
}.${
|
||||||
|
memberObj.banner.startsWith("a_")
|
||||||
|
? "gif?size=4096&_=.gif"
|
||||||
|
: "png?size=4096"
|
||||||
|
}`;
|
||||||
return {
|
return {
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
url && {
|
||||||
title: `Banner for \`${formatUsername(userObj)}\``,
|
title: `Banner for \`${formatUsername(userObj)}\``,
|
||||||
url,
|
url,
|
||||||
image: {
|
image: {
|
||||||
url,
|
url,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
guildUrl && {
|
||||||
|
title: `Server banner for \`${formatUsername(userObj)}\``,
|
||||||
|
url: guildUrl,
|
||||||
|
image: {
|
||||||
|
url: guildUrl,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
].filter((x) => !!x),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
hf.registerCommand(banner);
|
hf.registerCommand(banner);
|
||||||
|
|
Loading…
Reference in a new issue