utility.avatar: attempt multi-image embed trick

This commit is contained in:
Cynthia Foxwell 2022-04-03 10:37:26 -06:00
parent 618e42c1f3
commit 4e2ff7438a

View file

@ -109,29 +109,45 @@ avatar.callback = async function (msg, line) {
member = fetched[0]; member = fetched[0];
} }
} }
const avatar = member.avatar || member.user.avatar;
const url = const baseEmbed = {
guild && member.avatar title: `Avatar for \`${member.username}#${member.discriminator}\``,
? `https://cdn.discordapp.com/guilds/${guild.id}/users/${ };
member.id
}/avatars/${member.avatar}.${ const normalAvatar = member.user.avatar;
member.avatar.startsWith("a_") const guildAvatar = member.avatar;
? "gif?size=1024&_=.gif"
: "png?size=1024" const normalUrl =
}` AVATAR_BASE +
: `${AVATAR_BASE}${member.id}/${avatar}.${ member.id +
avatar.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024" "/" +
}`; 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 { return {
embeds: [ embeds: [baseEmbed, guildEmbed],
{
title: `Avatar for \`${member.username}#${member.discriminator}\``,
url,
image: {
url,
},
},
],
}; };
} }
} else { } else {