This is the code that I've tried:
message.author.dmChannel.awaitMessages(msg => {
console.log(msg.content)
});
But it returns this error message:
TypeError: Cannot read property 'awaitMessages' of null
Updated Code:
message.author.send("What is your name?")
const filter = m => m.author.id === message.author.id
message.author.dmChannel.awaitMessages(filter)
.then((collected) => console.log(collected.first().content))