Once a user creates an interaction in a discord channel I want to listen for new incomming messages in that channel. Here is the code I got
if(interaction.customId.startsWith("TRIGGER")){
let filter = m => m.author.id === interaction.author.id
interaction.channel.send(`Are you sure to delete all data? `YES` / `NO``).then(() => {
interaction.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 => {
interaction.channel.send('Timeout');
});
})
However I dont get the message objects. Its like no messages are send
How can I solve this issue ?