can't get avatar per server with user.ID

Hi guys, so there is my problem, I have an avatar command that displays avatar per server & default avatar, this actually works very good but only without any mentions. When I try to mention someone by ID or @ instead of showing me their avatar per server it shows MY avatar, but the default button works fine. I get avatar per user via message.member.displayAvatarURL and default avatar via user.displayAvatarURL I know what's the problem but I don't really know how to fix it, the principal problem is that message.member.displayAvatarURL doesn't get the ID that I mention in a message, while message.member.displayAvatarURL does, for example:
//this is console.log();

-------------------------------
message.mentions.users.first: 923090610028683265

usuario: 923090610028683265

member.user: 700076432076046396, TRKako#0833 //this is the thing that is wrong, this should be 923090610028683265(mentioned ID) instead of 700076432076046396(my ID)

user: 923090610028683265, TRKbot V13 test#8659

message.mentions.members.first: 923090610028683265
-------------------------------
//this is console.log();

-------------------------------
message.mentions.users.first: 923090610028683265

usuario: 923090610028683265

member.user: 700076432076046396, TRKako#0833 //this is the thing that is wrong, this should be 923090610028683265(mentioned ID) instead of 700076432076046396(my ID)

user: 923090610028683265, TRKbot V13 test#8659

message.mentions.members.first: 923090610028683265
-------------------------------
24 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TRKako
TRKakoOP2y ago
here's the code:
let usuario;
if (message.mentions.users.first()) {
usuario = message.mentions.users.first().id;
} else if (args[0]) {
usuario = args[0];
} else {
usuario = message.author.id;
}

const user = await client.users.fetch(usuario)

console.log(' message.mentions.users.first: '+message.mentions.users.first())
console.log('\n usuario: '+usuario)
console.log('\n member.user: '+message.member.user.id, message.member.user.tag)
console.log('\n user: '+user.id, user.tag)
console.log('\n message.mentions.members.first: '+message.mentions.members.first())

//default avatar embed
const embed = new Discord.MessageEmbed()
.setTitle('Avatar')
.setDescription(`Avatar: ` + '**`' + user.tag + '`**')
.setColor(`0x2F3136`)
.setImage(user.displayAvatarURL({format: "png", size: 4096, dynamic: true}))


//avatar per server avatar (only works fine when there's no mention)
const embed1 = new Discord.MessageEmbed()
.setTitle('Avatar')
.setDescription(`Avatar: ` + '**`' + user.tag + '`**')
.setColor(`0x2F3136`)
.setImage(message.member.displayAvatarURL({format: "png", size: 4096, dynamic: true}))
let usuario;
if (message.mentions.users.first()) {
usuario = message.mentions.users.first().id;
} else if (args[0]) {
usuario = args[0];
} else {
usuario = message.author.id;
}

const user = await client.users.fetch(usuario)

console.log(' message.mentions.users.first: '+message.mentions.users.first())
console.log('\n usuario: '+usuario)
console.log('\n member.user: '+message.member.user.id, message.member.user.tag)
console.log('\n user: '+user.id, user.tag)
console.log('\n message.mentions.members.first: '+message.mentions.members.first())

//default avatar embed
const embed = new Discord.MessageEmbed()
.setTitle('Avatar')
.setDescription(`Avatar: ` + '**`' + user.tag + '`**')
.setColor(`0x2F3136`)
.setImage(user.displayAvatarURL({format: "png", size: 4096, dynamic: true}))


//avatar per server avatar (only works fine when there's no mention)
const embed1 = new Discord.MessageEmbed()
.setTitle('Avatar')
.setDescription(`Avatar: ` + '**`' + user.tag + '`**')
.setColor(`0x2F3136`)
.setImage(message.member.displayAvatarURL({format: "png", size: 4096, dynamic: true}))
help FeelsBadMan
d.js docs
d.js docs2y ago
User#avatarURL() global custom avatar, if set • User#defaultAvatarURL default avatar (clyde with colored background) • User#displayAvatarURL() global custom avatar or default avatar, if none • GuildMember#avatarURL() guild specific avatar, if set
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TRKako
TRKakoOP2y ago
for example, let's say i want to see the avatar of a random user with nitro like this user
TRKako
TRKakoOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TRKako
TRKakoOP2y ago
this is what happends when I try to get his avatar
TRKako
TRKakoOP2y ago
if I click on the blue button I will get his default avatar, which works fine but I don't get his server avatar
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TRKako
TRKakoOP2y ago
yes, my problem here, is, how I put his ID in the member definition. I can do this in the user definition but in member doesn't work
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TRKako
TRKakoOP2y ago
yes, it's only an example, but people that have nitro and it's on the same server as my bot this keeps showing the avatar of the autor
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TRKako
TRKakoOP2y ago
oooooh
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TRKako
TRKakoOP2y ago
so, there's no way that I can display message.member.displayAvatarURL() with other user ID that isn't the author?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TRKako
TRKakoOP2y ago
damnn anyways, thanks for help me
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
TRKako
TRKakoOP2y ago
I'll give it a try, thx
Shaurya
Shaurya2y ago
meguFace
Want results from more Discord servers?
Add your server