mirror of
https://github.com/sern-handler/handler
synced 2026-06-13 03:12:15 +00:00
refactor: removed options builder as it is redundant
This commit is contained in:
@@ -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<OptionData[T], 'type'>) => ApplicationCommandOptionData | Omit<OptionData[T], 'type'> } creates options
|
||||
*/
|
||||
export function Option<T extends keyof OptionData>(type: T) {
|
||||
return (optionData: Omit<OptionData[T], 'type'>) => { return { type, ...optionData }; };
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user