The command should be like this:
Me - "!note"
Bot - "Question 1"
Me - "Answer"
Bot - (Sends embed to a specific channel with the first answer as title)
Bot - "Question 2"
Me - "Answer 2"
Bot - (Edits the embed and adds a description with the second answer)
Code:
module.exports = {
name: 'note',
description: 'Note',
async execute(client, message, args, Discord) {
let filter = m => m.author.id === message.author.id
message.channel.send(`Question 1`)
let collected = await message.channel.awaitMessages({ filter,
max: 1,
time: 10000,
errors: ['time']
});
let answer = collected.first();
let embed = new Discord.MessageEmbed()
.setTitle(`${answer}`)
.setDescription(`No second answer yet`)
const notechannel = client.channels.cache.get("<channel id>")
const sent = await notechannel.send({embeds:[embed]})
await message.channel.send(`Second question - **${answer}**?`)
let collected2 = await message.channel.awaitMessages({ filter,
max: 1,
time: 10000,
errors: ['time']
});
let answer2 = collected.first();
let embed2 = new Discord.MessageEmbed()
.setTitle(`${answer}`)
.setDescription(`${answer2}`)
sent.edit({embeds:[embed2]})
}
}
Now, everything works fine except for the last part. When i answer the second question, the bot edits the embed, but it edits the description with the first answer, not the second answer. Is there a way to solve this?