Home > Mobile >  Why im getting id number on discord.js with message.mentions.members.first()
Why im getting id number on discord.js with message.mentions.members.first()

Time:11-12

I was updating my bot to discord.js 13V on the update when I mention somone I trhows me enter image description here

this is the code im husing `

const   galletita1=  new Discord.MessageEmbed()

        .setDescription(message.author.username   `  Toma una galletita `       message.mentions.members.first())
       .setFooter({
text:"espero te guste"})
        .setColor(' #FFFF00')
        .setImage('http://pm1.narvii.com/6559/7ce32024e00c60cb695a8e838d5bcaf3264bc612_hq.jpg')
 

`

in the past version this work to display the username of the member you mention but now i get the number id

i tried to declare a variable with the message.mentions.members.first() and it works the same

CodePudding user response:

message.mentions.members I believe is a collection of guild members, so message.mentions.members.first() will return a guild member.

To get the user, I think you want message.mentions.members.first().user

CodePudding user response:

the answer is to delcare the variable

 const Target = message.mentions.users.first() || message.author;

and "text" Target.username

  • Related