utility.avatar: attempt multi-image embed trick
This commit is contained in:
parent
618e42c1f3
commit
4e2ff7438a
1 changed files with 38 additions and 22 deletions
|
@ -109,29 +109,45 @@ avatar.callback = async function (msg, line) {
|
|||
member = fetched[0];
|
||||
}
|
||||
}
|
||||
const avatar = member.avatar || member.user.avatar;
|
||||
const url =
|
||||
guild && member.avatar
|
||||
? `https://cdn.discordapp.com/guilds/${guild.id}/users/${
|
||||
member.id
|
||||
}/avatars/${member.avatar}.${
|
||||
member.avatar.startsWith("a_")
|
||||
? "gif?size=1024&_=.gif"
|
||||
: "png?size=1024"
|
||||
}`
|
||||
: `${AVATAR_BASE}${member.id}/${avatar}.${
|
||||
avatar.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024"
|
||||
}`;
|
||||
return {
|
||||
embeds: [
|
||||
{
|
||||
|
||||
const baseEmbed = {
|
||||
title: `Avatar for \`${member.username}#${member.discriminator}\``,
|
||||
url,
|
||||
image: {
|
||||
url,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const normalAvatar = member.user.avatar;
|
||||
const guildAvatar = member.avatar;
|
||||
|
||||
const normalUrl =
|
||||
AVATAR_BASE +
|
||||
member.id +
|
||||
"/" +
|
||||
normalAvatar +
|
||||
"." +
|
||||
normalAvatar.startsWith("a_")
|
||||
? "gif?size=1024&_=.gif"
|
||||
: "png?size=1024";
|
||||
const guildUrl =
|
||||
"https://cdn.discordapp.com/guilds/" +
|
||||
guild.id +
|
||||
"/users/" +
|
||||
member.id +
|
||||
"/avatars/" +
|
||||
guildAvatar +
|
||||
"." +
|
||||
guildAvatar.startsWith("a_")
|
||||
? "gif?size=1024&_=.gif"
|
||||
: "png?size=1024";
|
||||
|
||||
baseEmbed.description =
|
||||
`[Normal avatar](${normalUrl})` +
|
||||
(guild && guildAvatar ? `\n[Guild avatar](${guildUrl})` : "");
|
||||
|
||||
const guildEmbed = baseEmbed;
|
||||
baseEmbed.image = {url: normalUrl};
|
||||
guildEmbed.image = {url: guildUrl};
|
||||
|
||||
return {
|
||||
embeds: [baseEmbed, guildEmbed],
|
||||
};
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue