How to get the user id, username, nick when mentioned by another user

I tried m.mentions.members.first() but to no avail it didn't work as expected due to the mentions property being undefined despite mentioning someone. Any help would be appreciated! Here's the brief code:
module.exports = {

callback: async (m) => {

let user = m.member.nickname;
let mentionedUser = m.mentions.members.first();

if ( mentionedUser === undefined) {
m.channel.send("You need to mention someone!")
return;
}
m.channel.send(`${user} mentioned ${m.mentions.members.first()}`) //test
},
};
module.exports = {

callback: async (m) => {

let user = m.member.nickname;
let mentionedUser = m.mentions.members.first();

if ( mentionedUser === undefined) {
m.channel.send("You need to mention someone!")
return;
}
m.channel.send(`${user} mentioned ${m.mentions.members.first()}`) //test
},
};
15 Replies
d.js toolkit
d.js toolkit4mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
probablyraging
probablyraging4mo ago
Where is the message coming from, DM or channel? message.members don't exist in a DM channel message
Koi
Koi4mo ago
Oh I forgot to note that, it is indeed from a channel
chewie 🌈
chewie 🌈4mo ago
can you log m and show the output
Koi
Koi4mo ago
this?
No description
chewie 🌈
chewie 🌈4mo ago
no, log m first thing in the function console.log(m)
Koi
Koi4mo ago
I sent the message with a mention still null?
No description
chewie 🌈
chewie 🌈4mo ago
can you please show the whole thing
Koi
Koi4mo ago
alrighty holdon
Koi
Koi4mo ago
chewie 🌈
chewie 🌈4mo ago
thats not a djs message object then m.message is
Koi
Koi4mo ago
ooo i see so i'll have to do m.message first ?
chewie 🌈
chewie 🌈4mo ago
yes
Koi
Koi4mo ago
Omg it worked! Thank you
chewie 🌈
chewie 🌈4mo ago
:reallyFckingCuteCatThumbsUp: