const { SlashCommandBuilder, PermissionFlagsBits, ChatInputCommandInteraction, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('poll')
.setDescription('Создать голосование')
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption(options => options
.setName("question")
.setDescription("Укажите вопрос")
.setRequired(true)
),
/**
*
* @param {ChatInputCommandInteraction} interaction
*/
async execute(interaction) {
const pollQuestion = interaction.options.getString("question");
const pollEmbed = new EmbedBuilder()
.setTitle("Fury Голосование 📢")
.setDescription("**Вопрос:**\n" + pollQuestion)
.setImage("https://i.postimg.cc/jdZpyQ90/Line-1123.png")
.addFields([
{name: "Да", value: "0", inline: true},
{name: "Нет", value: "0", inline: true}
])
.setColor('Orange');
const replyObject = await interaction.reply({embeds: [pollEmbed], fetchReply: true});
const pollButtons = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel('Yes')
.setCustomId(`Poll-Yes-${replyObject.id}`)
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setLabel('No')
.setCustomId(`Poll-No-${replyObject.id}`)
.setStyle(ButtonStyle.Danger)
)
interaction.editReply({components: [pollButtons]});
}
}
const { SlashCommandBuilder, PermissionFlagsBits, ChatInputCommandInteraction, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('poll')
.setDescription('Создать голосование')
.setDMPermission(false)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addStringOption(options => options
.setName("question")
.setDescription("Укажите вопрос")
.setRequired(true)
),
/**
*
* @param {ChatInputCommandInteraction} interaction
*/
async execute(interaction) {
const pollQuestion = interaction.options.getString("question");
const pollEmbed = new EmbedBuilder()
.setTitle("Fury Голосование 📢")
.setDescription("**Вопрос:**\n" + pollQuestion)
.setImage("https://i.postimg.cc/jdZpyQ90/Line-1123.png")
.addFields([
{name: "Да", value: "0", inline: true},
{name: "Нет", value: "0", inline: true}
])
.setColor('Orange');
const replyObject = await interaction.reply({embeds: [pollEmbed], fetchReply: true});
const pollButtons = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel('Yes')
.setCustomId(`Poll-Yes-${replyObject.id}`)
.setStyle(ButtonStyle.Success),
new ButtonBuilder()
.setLabel('No')
.setCustomId(`Poll-No-${replyObject.id}`)
.setStyle(ButtonStyle.Danger)
)
interaction.editReply({components: [pollButtons]});
}
}