diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-05 20:11:08 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-05 20:11:08 -0400 |
commit | 18ba8b2743c3cad7e89b70d0e1dcacacc007f6d6 (patch) | |
tree | b50a46149623b79ed530ae34f09f6a46267e29b5 /src/commands | |
parent | e4206aaa9211e792660b4015551519d633409355 (diff) | |
download | tanzanite-18ba8b2743c3cad7e89b70d0e1dcacacc007f6d6.tar.gz tanzanite-18ba8b2743c3cad7e89b70d0e1dcacacc007f6d6.tar.bz2 tanzanite-18ba8b2743c3cad7e89b70d0e1dcacacc007f6d6.zip |
wip tickets
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/tickets/ticket-!.ts | 63 | ||||
-rw-r--r-- | src/commands/tickets/ticket-create.ts | 0 |
2 files changed, 63 insertions, 0 deletions
diff --git a/src/commands/tickets/ticket-!.ts b/src/commands/tickets/ticket-!.ts index e69de29..7751df1 100644 --- a/src/commands/tickets/ticket-!.ts +++ b/src/commands/tickets/ticket-!.ts @@ -0,0 +1,63 @@ +import { BushCommand, clientSendAndPermCheck, deepWriteable, type SlashMessage } from '#lib'; +import { Flag, type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo'; +import { ApplicationCommandOptionType } from 'discord.js'; + +export const ticketSubcommands = deepWriteable({ + create: { + description: 'Create a ticket.', + type: ApplicationCommandOptionType.Subcommand, + options: [ + { + name: 'word', + description: 'What word do you want to highlight?', + retry: '{error} Enter a valid word.', + type: ApplicationCommandOptionType.String, + required: true + } + ] + } +} as const); + +export default class TicketCommand extends BushCommand { + public constructor() { + super('ticket', { + aliases: ['ticket'], + category: 'ticket', + description: 'Manage tickets.', + usage: ['ticket create <reason>'], + examples: ['ticket creates very cool ticket'], + slashOptions: Object.entries(ticketSubcommands).map( + ([subcommand, options]) => ({ name: subcommand, ...options } as SlashOption) + ), + slash: true, + channel: 'guild', + clientPermissions: (m) => clientSendAndPermCheck(m), + userPermissions: [] + }); + } + + public override *args(): ArgumentGeneratorReturn { + const subcommand: keyof typeof ticketSubcommands = yield { + id: 'subcommand', + type: Object.keys(ticketSubcommands), + prompt: { + start: 'What sub command would you like to use?', + retry: `{error} Valid subcommands are: ${Object.keys(ticketSubcommands) + .map((s) => `\`${s}\``) + .join()}.` + } + }; + + return Flag.continue(`ticket-${subcommand}`); + } + + public override async exec() { + throw new Error('This command is not meant to be executed directly.'); + } + + public override async execSlash(message: SlashMessage, args: { subcommand: string; subcommandGroup?: string }) { + // manual `Flag.continue` + const subcommand = this.handler.modules.get(`ticket-${args.subcommandGroup ?? args.subcommand}`)!; + return subcommand.exec(message, args); + } +} diff --git a/src/commands/tickets/ticket-create.ts b/src/commands/tickets/ticket-create.ts new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/commands/tickets/ticket-create.ts |