utility.avatar: fixes for guild avatars

This commit is contained in:
Cynthia Foxwell 2021-08-29 20:02:12 -06:00
parent 159870877b
commit 4dadf820af

View file

@ -98,8 +98,9 @@ avatar.callback = async function (msg, line) {
) {
return user;
} else {
const url = `${AVATAR_BASE}${user.id}/${user.avatar}.${
user.avatar.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024"
const avatar = user.avatar || user.user.avatar;
const url = `${AVATAR_BASE}${user.id}/${avatar}.${
avatar.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024"
}`;
return {
embed: {
@ -112,10 +113,9 @@ avatar.callback = async function (msg, line) {
};
}
} else {
const url = `${AVATAR_BASE}${msg.author.id}/${msg.author.avatar}.${
msg.author.avatar.startsWith("a_")
? "gif?size=1024&_=.gif"
: "png?size=1024"
const avatar = msg.member.avatar || msg.author.avatar;
const url = `${AVATAR_BASE}${msg.author.id}/${avatar}.${
avatar.startsWith("a_") ? "gif?size=1024&_=.gif" : "png?size=1024"
}`;
return {
embed: {