utility.avatar: fixes
This commit is contained in:
parent
4e2ff7438a
commit
2dbe433b1d
1 changed files with 40 additions and 25 deletions
|
@ -123,9 +123,9 @@ avatar.callback = async function (msg, line) {
|
|||
"/" +
|
||||
normalAvatar +
|
||||
"." +
|
||||
normalAvatar.startsWith("a_")
|
||||
(normalAvatar.startsWith("a_")
|
||||
? "gif?size=1024&_=.gif"
|
||||
: "png?size=1024";
|
||||
: "png?size=1024");
|
||||
const guildUrl =
|
||||
"https://cdn.discordapp.com/guilds/" +
|
||||
guild.id +
|
||||
|
@ -134,9 +134,9 @@ avatar.callback = async function (msg, line) {
|
|||
"/avatars/" +
|
||||
guildAvatar +
|
||||
"." +
|
||||
guildAvatar.startsWith("a_")
|
||||
(guildAvatar.startsWith("a_")
|
||||
? "gif?size=1024&_=.gif"
|
||||
: "png?size=1024";
|
||||
: "png?size=1024");
|
||||
|
||||
baseEmbed.description =
|
||||
`[Normal avatar](${normalUrl})` +
|
||||
|
@ -152,28 +152,43 @@ avatar.callback = async function (msg, line) {
|
|||
}
|
||||
} else {
|
||||
const guild = msg.channel.guild || hf.bot.guilds.get(msg.guildID);
|
||||
const avatar = msg.member.avatar || msg.author.avatar;
|
||||
const url = msg.member.avatar
|
||||
? `https://cdn.discordapp.com/guilds/${guild.id}/users/${
|
||||
msg.member.id
|
||||
}/avatars/${msg.member.avatar}.${
|
||||
msg.member.avatar.startsWith("a_")
|
||||
? "gif?size=1024&_=.gif"
|
||||
: "png?size=1024"
|
||||
}`
|
||||
: `${AVATAR_BASE}${msg.author.id}/${avatar}.${
|
||||
avatar.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024"
|
||||
}`;
|
||||
|
||||
const baseEmbed = {
|
||||
title: `Avatar for \`${msg.author.username}#${msg.author.discriminator}\``,
|
||||
};
|
||||
|
||||
const normalAvatar = msg.author.avatar;
|
||||
const guildAvatar = msg.member?.avatar;
|
||||
|
||||
const normalUrl =
|
||||
AVATAR_BASE +
|
||||
msg.author.id +
|
||||
"/" +
|
||||
normalAvatar +
|
||||
"." +
|
||||
(normalAvatar.startsWith("a_")
|
||||
? "gif?size=1024&_=.gif"
|
||||
: "png?size=1024");
|
||||
const guildUrl =
|
||||
"https://cdn.discordapp.com/guilds/" +
|
||||
guild.id +
|
||||
"/users/" +
|
||||
msg.author.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: [
|
||||
{
|
||||
title: `Avatar for \`${msg.author.username}#${msg.author.discriminator}\``,
|
||||
url,
|
||||
image: {
|
||||
url,
|
||||
},
|
||||
},
|
||||
],
|
||||
embeds: [baseEmbed, guildEmbed],
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue