Files
website/docs/api/modules.md
Jacob Nguyen 62e0d6a61e feat: blogwork
2022-09-28 00:20:58 -05:00

18 KiB

id, title, sidebar_label, sidebar_position, custom_edit_url
id title sidebar_label sidebar_position custom_edit_url
modules @sern/handler Exports 0.5 null

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

Args

Ƭ Args: ParseType<{ slash: SlashOptions ; text: string[] }>

Defined in

src/types/handler.ts:12


AutocompletePlugin

Ƭ AutocompletePlugin: Override<BaseModule, { execute: (autocmp: AutocompleteInteraction, controlller: Controller) => Awaitable<Result<void, void>> ; type: Event }>

Defined in

src/handler/plugins/plugin.ts:92


BaseOptions

Ƭ BaseOptions: ApplicationCommandChoicesData | ApplicationCommandNonOptionsData | ApplicationCommandChannelOptionData | ApplicationCommandNumericOptionData | ApplicationCommandAttachmentOption | SernAutocompleteData

Type that replaces autocomplete with SernAutocompleteData

Defined in

src/handler/structures/module.ts:181


BothCommand

Ƭ BothCommand: Override<BaseModule, { alias?: string[] ; execute: (ctx: Context, args: Args) => Awaitable<void | unknown> ; onEvent: EventPlugin<Both>[] ; options?: SernOptionsData[] ; plugins: CommandPlugin[] ; type: Both }>

Defined in

src/handler/structures/module.ts:55


CommandModuleNoPlugins

Ƭ CommandModuleNoPlugins: { [T in CommandType]: Omit<CommandModuleDefs[T], "plugins" | "onEvent"> }

Defined in

src/handler/plugins/plugin.ts:145


CommandModulePlugin

Ƭ CommandModulePlugin<T>: EventPlugin<T> | CommandPlugin<T>

Type parameters

Name Type
T extends CommandType

Defined in

src/handler/plugins/plugin.ts:173


CommandPlugin

Ƭ CommandPlugin<T>: { [K in T]: Override<BasePlugin, Object> }[T]

Type parameters

Name Type
T extends keyof CommandModuleDefs = keyof CommandModuleDefs

Defined in

src/handler/plugins/plugin.ts:40


DefinedCommandModule

Ƭ DefinedCommandModule: DefinitelyDefined<CommandModule, "name" | "description">

Defined in

src/types/handler.ts:43


DefinedEventModule

Ƭ DefinedEventModule: DefinitelyDefined<EventModule, "name" | "description">

Defined in

src/types/handler.ts:44


DefinedModule

Ƭ DefinedModule: DefinitelyDefined<Module, "name" | "description">

After modules are transformed, name and description are given default values if none are provided to Module. This type represents that transformation

Defined in

src/types/handler.ts:42


DefinitelyDefined

Ƭ DefinitelyDefined<T, K>: { [L in K]-?: T[L] extends Record<string, unknown> ? DefinitelyDefined<T[L], keyof T[L]> : Required<T>[L] } & T

Type parameters

Name Type
T T
K extends keyof T = keyof T

Defined in

src/types/handler.ts:19


DiscordEmitterPlugin

Ƭ DiscordEmitterPlugin: Override<BasePlugin, { execute: (wrapper: Client, module: DefinitelyDefined<DiscordEventCommand, "name" | "description">, controller: Controller) => Awaitable<Result<void, void>> ; type: Command }>

Defined in

src/handler/plugins/plugin.ts:57


DiscordEventPlugin

Ƭ DiscordEventPlugin<T>: Override<BasePlugin, { execute: (args: ClientEvents[T], controller: Controller) => Awaitable<Result<void, void>> ; name?: T ; type: Event }>

Type parameters

Name Type
T extends keyof ClientEvents = keyof ClientEvents

Defined in

src/handler/plugins/plugin.ts:136


EventInput

Ƭ EventInput: string | { absPath: string ; mod: EventModule }[] | () => { absPath: string ; mod: EventModule }[]

Defined in

src/types/handler.ts:25


EventModuleCommandPluginDefs

Ƭ EventModuleCommandPluginDefs: Object

Event Module Command Plugins

Type declaration

Name Type
1 DiscordEmitterPlugin
2 SernEmitterPlugin
3 ExternalEmitterPlugin

Defined in

src/handler/plugins/plugin.ts:163


EventModuleEventPluginDefs

Ƭ EventModuleEventPluginDefs: Object

Event Module Event Plugins

Type declaration

Name Type
1 DiscordEventPlugin
2 SernEventPlugin
3 ExternalEventPlugin

Defined in

src/handler/plugins/plugin.ts:154


EventModulePlugin

Ƭ EventModulePlugin<T>: EventModuleEventPluginDefs[T] | EventModuleCommandPluginDefs[T]

Type parameters

Name Type
T extends EventType

Defined in

src/handler/plugins/plugin.ts:169


EventModulesNoPlugins

Ƭ EventModulesNoPlugins: { [T in EventType]: Omit<EventModuleDefs[T], "plugins" | "onEvent"> }

Defined in

src/handler/plugins/plugin.ts:148


EventPlugin

Ƭ EventPlugin<T>: { [K in T]: Override<BasePlugin, Object> }[T]

Type parameters

Name Type
T extends keyof CommandModuleDefs = keyof CommandModuleDefs

Defined in

src/handler/plugins/plugin.ts:103


ExternalEmitterPlugin

Ƭ ExternalEmitterPlugin<T>: Override<BasePlugin, { execute: (wrapper: T, module: DefinitelyDefined<ExternalEventCommand, "name" | "description">, controller: Controller) => Awaitable<Result<void, void>> ; type: Command }>

Type parameters

Name Type
T extends EventEmitter = EventEmitter

Defined in

src/handler/plugins/plugin.ts:68


ExternalEventPlugin

Ƭ ExternalEventPlugin: Override<BasePlugin, { execute: (args: unknown[], controller: Controller) => Awaitable<Result<void, void>> ; type: Event }>

Defined in

src/handler/plugins/plugin.ts:128


InputCommandModule

Ƭ InputCommandModule: { [T in CommandType]: CommandModuleNoPlugins[T] & Object }[CommandType]

User inputs this type. Sern processes behind the scenes for better usage

Defined in

src/handler/plugins/plugin.ts:178


InputEventModule

Ƭ InputEventModule: { [T in EventType]: EventModulesNoPlugins[T] & Object }[EventType]

Defined in

src/handler/plugins/plugin.ts:182


Module

Ƭ Module: CommandModule | EventModule

Defined in

src/handler/structures/module.ts:141


Nullish

Ƭ Nullish<T>: T | undefined | null

Type parameters

Name
T

Defined in

src/types/handler.ts:5


Override

Ƭ Override<T1, T2>: Omit<T1, keyof T2> & T2

Type parameters

Name
T1
T2

Defined in

src/types/handler.ts:17


ParseType

Ƭ ParseType<T>: { [K in keyof T]: T[K] extends unknown ? [k: K, args: T[K]] : never }[keyof T]

Type parameters

Name
T

Defined in

src/types/handler.ts:8


Payload

Ƭ Payload: { module: Module ; type: Success } | { module?: Module ; reason: string | Error ; type: Failure }

Defined in

src/types/handler.ts:45


ReplyOptions

Ƭ ReplyOptions: string | Omit<InteractionReplyOptions, "fetchReply"> | MessageReplyOptions

Defined in

src/types/handler.ts:55


SernAutocompleteData

Ƭ SernAutocompleteData: Override<BaseApplicationCommandOptionsData, { autocomplete: true ; command: AutocompleteCommand ; type: ApplicationCommandOptionType.String | ApplicationCommandOptionType.Number | ApplicationCommandOptionType.Integer }>

Defined in

src/handler/structures/module.ts:166


SernEmitterPlugin

Ƭ SernEmitterPlugin: Override<BasePlugin, { execute: (wrapper: SernEmitter, module: DefinitelyDefined<SernEventCommand, "name" | "description">, controller: Controller) => Awaitable<Result<void, void>> ; type: Command }>

Defined in

src/handler/plugins/plugin.ts:80


SernEventPlugin

Ƭ SernEventPlugin<T>: Override<BasePlugin, { execute: (args: SernEventsMapping[T], controller: Controller) => Awaitable<Result<void, void>> ; name?: T ; type: Event }>

Type parameters

Name Type
T extends keyof SernEventsMapping = keyof SernEventsMapping

Defined in

src/handler/plugins/plugin.ts:116


SernEventsMapping

Ƭ SernEventsMapping: Object

Type declaration

Name Type
error [Payload]
module.activate [Payload]
module.register [Payload]
warning [string]

Defined in

src/types/handler.ts:48


SernOptionsData

Ƭ SernOptionsData<U>: U extends ApplicationCommandSubCommandData ? SernSubCommandData : U extends ApplicationCommandSubGroupData ? SernSubCommandGroupData : BaseOptions

Type parameters

Name Type
U extends ApplicationCommandOptionData = ApplicationCommandOptionData

Defined in

src/handler/structures/module.ts:205


SernSubCommandData

Ƭ SernSubCommandData: Override<Omit<BaseApplicationCommandOptionsData, "required">, { options?: BaseOptions[] ; type: ApplicationCommandOptionType.Subcommand }>

Defined in

src/handler/structures/module.ts:189


SernSubCommandGroupData

Ƭ SernSubCommandGroupData: Override<Omit<BaseApplicationCommandOptionsData, "required">, { options?: SernSubCommandData[] ; type: ApplicationCommandOptionType.SubcommandGroup }>

Defined in

src/handler/structures/module.ts:197


SlashCommand

Ƭ SlashCommand: Override<BaseModule, { execute: (ctx: Context, args: ["slash", SlashOptions]) => Awaitable<void | unknown> ; onEvent: EventPlugin<Slash>[] ; options?: SernOptionsData[] ; plugins: CommandPlugin[] ; type: Slash }>

Defined in

src/handler/structures/module.ts:44


SlashOptions

Ƭ SlashOptions: Omit<CommandInteractionOptionResolver, "getMessage" | "getFocused">

Defined in

src/types/handler.ts:14


SpreadParams

Ƭ SpreadParams<T>: (args: Parameters<T>[number]) => unknown

Type parameters

Name Type
T extends (...args: never) => unknown

Type declaration

▸ (args): unknown

Turns a function with a union of array of args into a single union [ T , V , B ] | [ A ] => T | V | B | A

Parameters
Name Type
args Parameters<T>[number]
Returns

unknown

Defined in

src/types/handler.ts:34


TextCommand

Ƭ TextCommand: Override<BaseModule, { alias?: string[] ; execute: (ctx: Context, args: ["text", string[]]) => Awaitable<void | unknown> ; onEvent: EventPlugin<Text>[] ; plugins: CommandPlugin[] ; type: Text }>

Defined in

src/handler/structures/module.ts:33

Functions

commandModule

commandModule(mod): CommandModule

The wrapper function to define command modules for sern

Parameters

Name Type
mod InputCommandModule

Returns

CommandModule

Defined in

src/handler/sern.ts:91


eventModule

eventModule(mod): EventModule

The wrapper function to define event modules for sern

Parameters

Name Type
mod InputEventModule

Returns

EventModule

Defined in

src/handler/sern.ts:112