我试图让我的机器人等待直接消息(在本例中是某个名称),然后将其写回到直接消息中的同一用户(在本例中是我)。
我尝试使用message.author.awaitMessages
但控制台返回:
TypeError: message.author.awaitResponse is not a function
message.author.send('Write your Name')
.then(function(){
message.channel.awaitMessages(response => message.content, {
max: 1,
time: 300000000,
errors: ['time'],
})
.then((collected) => {
message.author.send(`Your Name is: ${collected.first().content}`);
})
.catch(function(){
message.channel.send('You didnt write your name');
});
});
}
最佳答案
尝试message.author.dmChannel.awaitMessages
查看文档中的更多信息 https://discord.js.org/#/docs/main/stable/class/User?scrollTo=dmChannel
关于javascript - 在 Direct Message Discord js 中等待来自用户的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47722608/