diff --git a/commands/games-sp/20-questions.js b/commands/games-sp/20-questions.js index 4dc99f23..03895875 100644 --- a/commands/games-sp/20-questions.js +++ b/commands/games-sp/20-questions.js @@ -64,13 +64,10 @@ module.exports = class TwentyQuestionsCommand extends Command { for (let i = 0; i < rowCount; i++) rows.push(new MessageActionRow()); for (let i = 0; i < answers.length; i += 5) { const row = rows[i]; - row.addComponents([ - new MessageButton().setCustomId(answers[i]).setStyle('PRIMARY').setLabel(answers[i]), - new MessageButton().setCustomId(answers[i + 1]).setStyle('PRIMARY').setLabel(answers[i + 1]), - new MessageButton().setCustomId(answers[i + 2]).setStyle('PRIMARY').setLabel(answers[i + 2]), - new MessageButton().setCustomId(answers[i + 3]).setStyle('PRIMARY').setLabel(answers[i + 3]), - new MessageButton().setCustomId(answers[i + 4]).setStyle('PRIMARY').setLabel(answers[i + 4]) - ]); + const components = answers.slice(i, i + 5); + for (const component of components) { + row.addComponents(new MessageButton().setCustomId(component).setStyle('PRIMARY').setLabel(component)); + } } const sRow = new MessageActionRow(); sRow.addComponents(new MessageButton().setCustomId('end').setStyle('DANGER').setLabel('End'));