const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Embed } = require('discord.js'); module.exports = { data: new SlashCommandBuilder() .setName('8ball') .setDescription('Ask the Magic 8-ball a question') .addStringOption(option => option.setName('question').setDescription('The question you want to ask the Magic 8-ball').setRequired(true)), async execute(interaction, client) { const { options } = interaction; const question = options.getString('question'); const choice = [ "🎱| It is certain.", "🎱| It is decidedly so.", "🎱| Without a doubt.", "🎱| Yes definitely.", "🎱| You may rely on it.", "🎱| As I see it, yes.", "🎱| Most likely.", "🎱| Outlook good.", "🎱| Yes.", "🎱| Signs point to yes.", "🎱| Reply hazy, try again.", "🎱| Ask again later.", "🎱| Better not tell you now.", "🎱| Cannot predict now.", "🎱| Concentrate and ask again.", "🎱| Don't count on it.", "🎱| My reply is no.", "🎱| My sources say no.", "🎱| Outlook not so good.", "🎱| Very doubtful." ]; const ball = Math.floor(Math.random() * choice.length); const embed = new EmbedBuilder() .setColor('edd9b6') .setTitle(`🎱| ${interaction.user.username}'s 8-ball game.`) .addFields({ name: "Question", value: `${question}`, inline:true}) const embed2 = new EmbedBuilder() .setColor('edd9b6') .setTitle(`🎱| ${interaction.user.username}'s 8-ball game.`) .addFields({ name: "Question", value: `${question}`, inline:true}) .addFields({ name: "Answer", value: `${choice[ball]}`, inline:true}) const button = new ActionRowBuilder() .addComponents( new ButtonBuilder() .setCustomId('button') .setLabel(`🎱 Roll the Magic 8-Ball!`) .setStyle(ButtonStyle.Primary) ) const msg = await interaction.reply({ embeds: [embed], compontents: [button], withResponse: true }); const collector = await msg.replyMessageComponentCollector(); collector.on('collect', async i => { if (i.customId == 'button') { i.update({ embeds: [embed2], compontents: []}) } }) }, };