简体   繁体   中英

Discord.js AwaitMessages in DM's not working

 msg.channel.send("Please explain the bug").then(function(){ msg.channel.awaitMessages(response => message.content, { max: 1, time: 300000000, errors: ['time'] }).then((collected) => { msg.author.send(`The bug is: ${collected.first().content}`); }).catch(function(){ msg.channel.send('Out of time'); }); });

CODE ^

I am trying to run a AwaitMessage function inside the user's DM's, but its not working. Can anyone help?

The error - UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user

My DM's are enabled to everyone

The error indicates that the user cannot receive the message, try logging the user first and looking if he can actually receive DM's, also please add to the question in what line this error occurred.

If that's not the case add more of the code to the question so we can see if the error has roots earlier on the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM