From 81921937b53167edf2d91ba1fb9136da1bbade77 Mon Sep 17 00:00:00 2001 From: jacoobes Date: Mon, 21 Feb 2022 00:41:34 -0600 Subject: [PATCH] refactor: removed options builder as it is redundant --- src/handler/utilities/higherOrders.ts | 10 ---------- src/types/options.ts | 27 --------------------------- 2 files changed, 37 deletions(-) delete mode 100644 src/types/options.ts diff --git a/src/handler/utilities/higherOrders.ts b/src/handler/utilities/higherOrders.ts index 16cec0b..8f49e15 100644 --- a/src/handler/utilities/higherOrders.ts +++ b/src/handler/utilities/higherOrders.ts @@ -1,5 +1,4 @@ import type { Message } from 'discord.js'; -import type { OptionData } from '../../types/options'; type MsgFnArgs = [msgOrInter: Message, prefix?: string]; type MsgFn = (...args: MsgFnArgs) => boolean; @@ -14,13 +13,4 @@ export function AllTrue(...fns: MsgFn[]): return (message: Message, prefix: string) => { return fns.every(g => g(message, prefix)); }; -} - -/** - * A HoF that acts as a ligtweight slash command options builder, enabling user with intellisense - * @param { T extends keyof OptionData } type type of option - * @returns { (optionData: Omit) => ApplicationCommandOptionData | Omit } creates options - */ -export function Option(type: T) { - return (optionData: Omit) => { return { type, ...optionData }; }; } \ No newline at end of file diff --git a/src/types/options.ts b/src/types/options.ts deleted file mode 100644 index 439d2e5..0000000 --- a/src/types/options.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { - ApplicationCommandAutocompleteOption, - ApplicationCommandChannelOptionData, - ApplicationCommandChoicesOption, - ApplicationCommandNonOptionsData, - ApplicationCommandNumericOptionData, - ApplicationCommandSubCommandData, - ApplicationCommandSubGroupData -} from 'discord.js'; - -// TODO : make required property optional -type BaseOption = { name : string, description : string, required : false }; - -export interface OptionData { - SUB_COMMAND: ApplicationCommandSubCommandData - SUB_COMMAND_GROUP: ApplicationCommandSubGroupData - NONE: ApplicationCommandNonOptionsData - CHANNEL: ApplicationCommandChannelOptionData - CHOICE: ApplicationCommandChoicesOption - AUTO: ApplicationCommandAutocompleteOption - NUMBER: ApplicationCommandNumericOptionData - INTEGER: ApplicationCommandNumericOptionData - USER : { type: 'USER' } & BaseOption - MENTIONABLE: { type : 'MENTIONABLE' } & BaseOption - ROLE : { type: 'ROLE' } & BaseOption - BOOLEAN : { type: 'BOOLEAN' } & BaseOption -} \ No newline at end of file