From 302461fcd34de14eccd4d18664af3fc12a37b4d5 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sun, 29 May 2022 22:18:16 -0400 Subject: fix: comment out poll command --- src/commands/utilities/_poll.ts | 81 +++++++++++++++++++++++++++++++++++++++++ src/commands/utilities/poll.ts | 80 ---------------------------------------- 2 files changed, 81 insertions(+), 80 deletions(-) create mode 100644 src/commands/utilities/_poll.ts delete mode 100644 src/commands/utilities/poll.ts diff --git a/src/commands/utilities/_poll.ts b/src/commands/utilities/_poll.ts new file mode 100644 index 0000000..81bb5fc --- /dev/null +++ b/src/commands/utilities/_poll.ts @@ -0,0 +1,81 @@ +/* import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import { ApplicationCommandOptionType, ComponentType } from 'discord.js'; + +export default class PollCommand extends BushCommand { + public constructor() { + super('poll', { + aliases: ['poll', 'quick-poll'], + category: 'utilities', + description: 'Allows you to create a poll that other users can vote on. Separate options with "," or "|".', + usage: ['poll options'], + examples: ['poll 1 2'], + args: [ + { + id: 'question', + description: 'The question to be answered by a poll.', + type: 'string', + prompt: 'What question would you like to ask?', + retry: '{error} Choose a question.', + slashType: ApplicationCommandOptionType.String, + only: 'slash' + }, + { + id: 'options', + description: 'The options to include in the poll. Separate options with "," or "|".', + type: 'string', + prompt: 'What options you want to include in the poll? Separate options with "," or "|".', + retry: '{error} Choose options for the poll. Separate options with "," or "|".', + slashType: ApplicationCommandOptionType.String + } + ], + slash: true, + clientPermissions: (m) => util.clientSendAndPermCheck(m), + userPermissions: [] + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, args: { question?: string; options: ArgType<'string'> }) { + const { question, options } = this.parseArgs(message, args); + if (!question || !options.length) return; + + if (question.length > 256) return await message.util.reply(`${util.emojis.error} Question must be 256 characters or less.`); + if (options.length > 10) return await message.util.reply(`${util.emojis.error} You can only have upto 10 options.`); + + return message.util.send({ + embeds: [ + { + author: { name: `asked by: ${message.author.tag}`, icon_url: message.author.displayAvatarURL() || undefined }, + title: question + } + ], + components: [ + { + type: ComponentType.ActionRow, + components: [] + } + ] + }); + } + + private parseArgs( + message: BushMessage | BushSlashMessage, + args: { question?: string; options: ArgType<'string'> } + ): { question: string; options: string[] } { + const split = args.options.split(/[,|]/).filter((s) => s.trim().length > 0); + if (message.util.isSlash) { + if (split.length < 2) { + void message.util.reply(`${util.emojis.error} You must provide at least two options.`); + return { question: '', options: [] }; + } + return { question: args.question!, options: split }; + } else { + if (split.length < 3) { + void message.util.reply(`${util.emojis.error} You must provide a question and at least two options.`); + return { question: '', options: [] }; + } + + return { question: split[0], options: split.slice(1) }; + } + } +} + */ diff --git a/src/commands/utilities/poll.ts b/src/commands/utilities/poll.ts deleted file mode 100644 index e53eb51..0000000 --- a/src/commands/utilities/poll.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, ComponentType } from 'discord.js'; - -export default class PollCommand extends BushCommand { - public constructor() { - super('poll', { - aliases: ['poll', 'quick-poll'], - category: 'utilities', - description: 'Allows you to create a poll that other users can vote on. Separate options with "," or "|".', - usage: ['poll options'], - examples: ['poll 1 2'], - args: [ - { - id: 'question', - description: 'The question to be answered by a poll.', - type: 'string', - prompt: 'What question would you like to ask?', - retry: '{error} Choose a question.', - slashType: ApplicationCommandOptionType.String, - only: 'slash' - }, - { - id: 'options', - description: 'The options to include in the poll. Separate options with "," or "|".', - type: 'string', - prompt: 'What options you want to include in the poll? Separate options with "," or "|".', - retry: '{error} Choose options for the poll. Separate options with "," or "|".', - slashType: ApplicationCommandOptionType.String - } - ], - slash: true, - clientPermissions: (m) => util.clientSendAndPermCheck(m), - userPermissions: [] - }); - } - - public override async exec(message: BushMessage | BushSlashMessage, args: { question?: string; options: ArgType<'string'> }) { - const { question, options } = this.parseArgs(message, args); - if (!question || !options.length) return; - - if (question.length > 256) return await message.util.reply(`${util.emojis.error} Question must be 256 characters or less.`); - if (options.length > 10) return await message.util.reply(`${util.emojis.error} You can only have upto 10 options.`); - - return message.util.send({ - embeds: [ - { - author: { name: `asked by: ${message.author.tag}`, icon_url: message.author.displayAvatarURL() || undefined }, - title: question - } - ], - components: [ - { - type: ComponentType.ActionRow, - components: [] - } - ] - }); - } - - private parseArgs( - message: BushMessage | BushSlashMessage, - args: { question?: string; options: ArgType<'string'> } - ): { question: string; options: string[] } { - const split = args.options.split(/[,|]/).filter((s) => s.trim().length > 0); - if (message.util.isSlash) { - if (split.length < 2) { - void message.util.reply(`${util.emojis.error} You must provide at least two options.`); - return { question: '', options: [] }; - } - return { question: args.question!, options: split }; - } else { - if (split.length < 3) { - void message.util.reply(`${util.emojis.error} You must provide a question and at least two options.`); - return { question: '', options: [] }; - } - - return { question: split[0], options: split.slice(1) }; - } - } -} -- cgit