let comArr = [`slice`, `call`, `walk`];
let actionVal = 0;
await msg.edit({ ephemeral: false, embeds: [embed], components: [buttonArr] });
let filter = m => comArr.includes(m.customId) && m.user.id == message.author.id;
let collector = await message.channel.createMessageComponentCollector({ componentType: Discord.ComponentType.Button, filter, time: 15000 });
collector.on('collect', async i => {
await i.deferUpdate();
await n.sleep(50);
console.log(i.customId)
if (i.customId == `slice`) {
actionVal = 1;
collector.emit('end', collected => { });
} else if (i.customId == `call`) {
actionVal = 2;
collector.emit('end', collected => { });
} else if (i.customId == `walk`) {
actionVal = 3;
collector.emit('end', collected => { });
} else {
collector.emit('end', collected => { });
}
});
// end collector event
collector.on('end', async collected => {
console.log(actionVal)
let embed3 = new Discord.EmbedBuilder()
.setColor(`${n.color()}`)
.setTitle(`test`)
});
await msg.edit({ ephemeral: false, embeds: [embed3], components: [] });
});
await n.sleep(5000);
console.log(`finish`)