So I created some code that should make the bot send an embed with what I wrote when the command is executed. It works, however when I answer with what I wrote (which would be test) it does not answer me! I have tried everything but it does not work! Thanks for help in advance.
Here is the code:
const {MessageEmbed} = require("discord.js")
const sdb = require('x73db');
const db = new sdb("points");
module.exports = {
name: 'fast',
execute(client, message, args) {
if(!args [0] ) return message.reply("example : -fast hi ")
let text = args.join(' ')
const filter = response => {
return text.answers.some(answer => answer.toLowerCase() === response.content.toLowerCase());
};
let embed = new MessageEmbed()
.setAuthor({ name: `${client.user.tag}`, iconURL: client.user.displayAvatarURL()
})
.setThumbnail(message.guild.iconURL())
.setTitle("fast")
.setDescription(`**${text}**`)
.setColor("GREYPLE")
.setTimestamp()
.setFooter({ text: client.user.tag , iconURL: message.guild.iconURL()
})
message.channel.send({content:`by <@${message.author.id}>`, embeds:[embed]})
message.channel.awaitMessages(filter, {
max: 1,
time: 20000,
errors: ['time']
}).then(collected => {
copy1 = collected.first().content;
won1 = collected.first().author;
let r1 = db.get(`points_${won1.id}`);
if (copy1 == text.answers){
if(!r1) {
r1 = 0;
db.set(`points_${won1.id}`, 0);
}
message.channel.send(`**${collected.first().author} you did it**`);
console.log(`[Typing] ${collected.first().author} typed the word.`);
copy1 = collected.first().content;
db.set(`points_${won1.id}`, r1 + 1);
}else{
if(!r1) {
r1 = 0;
db.set(`points_${won1.id}_trn`, 0);
}
message.channel.send(`**${collected.first().author} you did it**`);
console.log(`[Typing] ${collected.first().author} typed the word.`);
copy1 = collected.first().content;
db.set(`points_${won1.id}_trn`, r1 + 1);
}
})
.catch(collected=>{
message.channel.send("time is over..");
})
}
}