nyx/command/Utilities/poll.js

80 lines
1.9 KiB
JavaScript
Raw Normal View History

2022-10-26 12:38:28 +02:00
const { EmbedBuilder } = require("discord.js");
module.exports = {
2022-01-29 03:38:24 +01:00
name: "poll",
category: "Utilities",
description: "Creates a poll with many options",
options: [
{
type: 3,
name: "question",
description: "The question of the poll",
required: true,
},
2022-01-29 03:38:24 +01:00
{
type: 3,
name: "choice1",
description: "Choice 1",
required: true,
},
{
type: 3,
name: "choice2",
description: "Choice 2",
required: true,
},
{
type: 3,
name: "choice3",
description: "Choice 3",
required: false,
},
{
type: 3,
name: "choice4",
description: "Choice 4",
required: false,
},
{
type: 3,
name: "choice5",
description: "Choice 5",
required: false,
},
{
type: 3,
name: "choice6",
description: "Choice 6",
required: false,
},
],
run: async (client, interaction, args) => {
2022-10-26 12:38:28 +02:00
const pollCreateEmbed = new EmbedBuilder()
2022-01-29 03:38:24 +01:00
.setTitle(`📣 **${args[0]}**`)
2023-02-03 23:28:45 +01:00
.setColor("Red")
2022-01-29 03:38:24 +01:00
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL(),
})
.setTimestamp();
for (let i = 0; i < args.length - 1; i++) {
pollCreateEmbed.addField(
"",
`:regional_indicator_${String.fromCharCode(97 + i)}: ${args[i + 1]}
`
);
}
let embedMessage = await interaction.followUp({
embeds: [pollCreateEmbed],
});
55356;
for (let i = 0; i < args.length - 1; i++) {
if (i === 0) embedMessage.react("\ud83c\udde6");
if (i === 1) embedMessage.react("\ud83c\udde7");
if (i === 2) embedMessage.react("\ud83c\udde8");
if (i === 3) embedMessage.react("\ud83c\udde9");
if (i === 4) embedMessage.react("\ud83c\uddea");
if (i === 5) embedMessage.react("\ud83c\uddeb");
}
},
};