const { SlashCommandBuilder, bold } = require('@discordjs/builders'); const { MessageEmbed } = require('discord.js'); const command = new SlashCommandBuilder() .setName('poll') .setDescription('Sondage') .addStringOption(option => option.setName('question') .setDescription('La question que vous souhaitez poser aux autres utilisateurs') .setRequired(true) ); for (let i = 0; i<20;i++){ var index = i + 1; command.addStringOption(option => option.setName('rรฉponse' + index ) .setDescription('La rรฉponse ' + index) .setRequired(false) ); } module.exports = { data: command, async execute(interaction) { const question = interaction.options.get('question').value; const answers = interaction.options.data.slice(1, interaction.options.data.length); const reactions = ['๐Ÿ‡ฆ', '๐Ÿ‡ง', '๐Ÿ‡จ', '๐Ÿ‡ฉ', '๐Ÿ‡ช', '๐Ÿ‡ซ', '๐Ÿ‡ฌ', '๐Ÿ‡ญ', '๐Ÿ‡ฎ', '๐Ÿ‡ฏ', '๐Ÿ‡ฐ', '๐Ÿ‡ฑ', '๐Ÿ‡ฒ', '๐Ÿ‡ณ', '๐Ÿ‡ด', '๐Ÿ‡ต', '๐Ÿ‡ถ', '๐Ÿ‡ท', '๐Ÿ‡ธ', '๐Ÿ‡น', '๐Ÿ‡บ', '๐Ÿ‡ป', '๐Ÿ‡ผ', '๐Ÿ‡ฝ', '๐Ÿ‡พ', '๐Ÿ‡ฟ' ]; var desc = ""; var j = 0; answers.forEach(element => { desc += reactions[j] + ' : ' + element.value + '\n'; j++; }); const embed = new MessageEmbed() .setDescription(desc) .setColor('RANDOM') var message = await interaction.reply({content : '๐Ÿ“Š ' + bold(question), embeds: [embed], fetchReply: true}); j = 0; answers.forEach(element=>{ message.react(reactions[j]); j++; }) }, };