import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; //@ts-ignore no types import emoji from 'emoji-random' import config from '../../config.json' module.exports = class PollServer extends Command { constructor(client: CommandoClient) { super(client, { name: 'poll', group: 'server', memberName: 'poll', description: 'Make a poll.', examples: ['uwu!poll am i cool?'], throttling: { usages: 5, duration: 30 }, userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], guildOnly: true }); } //@ts-ignore this is not async run(msg: CommandoMessage) { if (config['validUsers'].includes(msg.author.id)) { let messageArray = msg.content.split(' ') let args = messageArray.slice(1) if (!args || args.length < 1) { return msg.reply(`No poll content was specified. ${emoji.random()}`) } else { let emb = new MessageEmbed() .setColor(0xFFCC4D) .setFooter('React to vote.') .setDescription(args.join(' ')) .setTitle(`Poll Created by ${msg.author.username} ${emoji.random()}`) return msg.say(emb).then(fMsg => { //@ts-ignore yes these exist fMsg.react('✅') //@ts-ignore yes these exist fMsg.react('❎') //@ts-ignore yes these exist msg.delete({ timeout: 1000 }) }) } } else { msg.delete() //@ts-ignore return msg.reply(`Insufficent permissions! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 })) } } };