2021-09-06 12:38:25 +02:00
|
|
|
const { MessageEmbed } = require("discord.js");
|
|
|
|
module.exports = {
|
|
|
|
name: "poll",
|
|
|
|
description: "Start a poll in a channel",
|
|
|
|
category: "Utilities",
|
|
|
|
type: "CHAT_INPUT",
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
type: 3,
|
|
|
|
name: "description",
|
|
|
|
description: "The description of the poll",
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 7,
|
|
|
|
name: "channel",
|
|
|
|
description: "The channel you want to send the poll",
|
|
|
|
required: false,
|
2021-11-18 18:56:42 +01:00
|
|
|
channelTypes: ["GUILD_TEXT"],
|
2021-09-06 12:38:25 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
run: async (client, interaction, args) => {
|
|
|
|
await interaction.deleteReply();
|
2021-11-18 18:56:42 +01:00
|
|
|
const pollDescription = `
|
2021-09-06 12:38:25 +02:00
|
|
|
${interaction.member} asks: ${args[0]}`;
|
|
|
|
const channel =
|
|
|
|
interaction.guild.channels.cache.get(args[1]) || interaction.channel;
|
2021-11-18 18:56:42 +01:00
|
|
|
const embedPoll = new MessageEmbed()
|
|
|
|
.setTitle(`${interaction.user.tag} made a poll`)
|
2021-09-06 12:38:25 +02:00
|
|
|
.setDescription(pollDescription)
|
2021-11-18 18:56:42 +01:00
|
|
|
.setFooter(`Made by ${client.author}`, client.user.displayAvatarURL())
|
2021-09-06 12:38:25 +02:00
|
|
|
.setTimestamp()
|
|
|
|
.setColor("GREEN");
|
2021-11-18 18:56:42 +01:00
|
|
|
const msgEmbed = await channel.send({ embeds: [embedPoll] });
|
2021-09-06 12:38:25 +02:00
|
|
|
await msgEmbed.react("👍");
|
|
|
|
await msgEmbed.react("👎");
|
|
|
|
},
|
|
|
|
};
|