Discord.js reply to message then wait for reply
Compare with == And Try.
if (command === 'spec'){
message.author.send("See or Change?");
const collector = new Discord.MessageCollector(message.channel, m => m.author.id === message.author.id, { time: 10000 });
console.log(collector)
collector.on('collect', message => {
if (message.content == "See") {
message.channel.send("You Want To See Someones Spec OK!");
} else if (message.content == "Change") {
message.channel.send("You Want To Change Your Spec OK!");
}
})
let filter = m => m.author.id === message.author.id
message.channel.send(`Are you sure to delete all data? \`YES\` / \`NO\``).then(() => {
message.channel.awaitMessages(filter, {
max: 1,
time: 30000,
errors: ['time']
})
.then(message => {
message = message.first()
if (message.content.toUpperCase() == 'YES' || message.content.toUpperCase() == 'Y') {
message.channel.send(`Deleted`)
} else if (message.content.toUpperCase() == 'NO' || message.content.toUpperCase() == 'N') {
message.channel.send(`Terminated`)
} else {
message.channel.send(`Terminated: Invalid Response`)
}
})
.catch(collected => {
message.channel.send('Timeout');
});
})