Skip to main content

@sern/handler

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

AnyCommandPlugin

Ƭ AnyCommandPlugin: ControlPlugin | InitPlugin<[InitArgs<Processed<CommandModule>>]>

Defined in

src/types/plugin.ts:42


AnyDefinedModule

Ƭ AnyDefinedModule: Processed<CommandModule | EventModule>

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:24


AnyEventPlugin

Ƭ AnyEventPlugin: ControlPlugin | InitPlugin<[InitArgs<Processed<EventModule>>]>

Defined in

src/types/plugin.ts:43


AnyModule

Ƭ AnyModule: CommandModule | EventModule

Defined in

src/types/module.ts:150


Args

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

Defined in

src/types/handler.ts:16


AutocompletePlugin

Ƭ AutocompletePlugin: Deprecated<"Please view alternatives: ">

Defined in

src/types/plugin.ts:68


BaseOptions

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

Type that replaces autocomplete with SernAutocompleteData

Defined in

src/types/module.ts:203


CommandArgs

Ƭ CommandArgs<I, J>: CommandArgsMatrix[I][`J`]

Type parameters

NameType
Iextends CommandType = CommandType
Jextends PluginType = PluginType

Defined in

src/handler/plugins/args.ts:109


CommandModule

Ƭ CommandModule: TextCommand | SlashCommand | BothCommand | ContextMenuUser | ContextMenuMsg | ButtonCommand | StringSelectCommand | MentionableSelectCommand | UserSelectCommand | ChannelSelectCommand | RoleSelectCommand | ModalSubmitCommand

Defined in

src/types/module.ts:136


CommandModuleDefs

Ƭ CommandModuleDefs: Object

Type declaration

NameType
1TextCommand
1024RoleSelectCommand
16ButtonCommand
2SlashCommand
2048UserSelectCommand
256ChannelSelectCommand
3BothCommand
32StringSelectCommand
4ContextMenuUser
512MentionableSelectCommand
64ModalSubmitCommand
8ContextMenuMsg

Defined in

src/types/module.ts:154


CommandModuleNoPlugins

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

Defined in

src/types/module.ts:185


Deprecated

Ƭ Deprecated<Message>: [never, Message]

Type parameters

NameType
Messageextends string

Defined in

src/types/handler.ts:65


DiscordEmitterPlugin

Ƭ DiscordEmitterPlugin: Deprecated<"Please view alternatives: ">

Defined in

src/types/plugin.ts:65


DiscordEventPlugin

Ƭ DiscordEventPlugin: Deprecated<"Please view alternatives: ">

Defined in

src/types/plugin.ts:71


EventArgs

Ƭ EventArgs<I, J>: EventArgsMatrix[I][`J`]

Type parameters

NameType
Iextends EventType = EventType
Jextends PluginType = PluginType

Defined in

src/handler/plugins/args.ts:113


EventModule

Ƭ EventModule: DiscordEventCommand | SernEventCommand | ExternalEventCommand

Defined in

src/types/module.ts:135


EventModuleDefs

Ƭ EventModuleDefs: Object

Type declaration

NameType
1DiscordEventCommand
2SernEventCommand
3ExternalEventCommand

Defined in

src/types/module.ts:169


EventModulesNoPlugins

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

Defined in

src/types/module.ts:188


ExternalEmitterPlugin

Ƭ ExternalEmitterPlugin: Deprecated<"Please view alternatives: ">

Defined in

src/types/plugin.ts:66


ExternalEventPlugin

Ƭ ExternalEventPlugin: Deprecated<"Please view alternatives: ">

Defined in

src/types/plugin.ts:70


InputCommand

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

Defined in

src/types/module.ts:196


InputEvent

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

Defined in

src/types/module.ts:192


LogPayload

Ƭ LogPayload<T>: Object

Type parameters

NameType
Tunknown

Type declaration

NameType
messageT

Defined in

src/types/handler.ts:35


MapDeps

Ƭ MapDeps<Deps, T>: T extends [infer First, ...(infer Rest extends readonly unknown[])] ? [UnpackFunction<Deps[First]>, ...(MapDeps<Deps, Rest> extends [never] ? [] : MapDeps<Deps, Rest>)] : [never]

Type parameters

NameType
Depsextends Dependencies
Textends readonly unknown[]

Defined in

src/types/handler.ts:53


OptionalDependencies

Ƭ OptionalDependencies: "@sern/logger"

Defined in

src/types/handler.ts:63


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:12


Payload

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

Defined in

src/types/handler.ts:25


PluginResult

Ƭ PluginResult: Awaitable<VoidResult>

Defined in

src/types/plugin.ts:21


Processed

Ƭ Processed<T>: T & { description: string ; name: string }

Type parameters

Name
T

Defined in

src/types/handler.ts:64


ReplyOptions

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

Defined in

src/types/handler.ts:48


SernEmitterPlugin

Ƭ SernEmitterPlugin: Deprecated<"Please view alternatives: ">

Defined in

src/types/plugin.ts:67


SernEventPlugin

Ƭ SernEventPlugin: Deprecated<"Please view alternatives: ">

Defined in

src/types/plugin.ts:69


SernEventsMapping

Ƭ SernEventsMapping: Object

Type declaration

NameType
error[Payload]
module.activate[Payload]
module.register[Payload]
warning[Payload]

Defined in

src/types/handler.ts:29


SernOptionsData

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

Type parameters

NameType
Uextends ApplicationCommandOptionData = ApplicationCommandOptionData

Defined in

src/types/module.ts:223


Singleton

Ƭ Singleton<T>: () => T

Type parameters

Name
T

Type declaration

▸ (): T

Returns

T

Defined in

src/types/handler.ts:36


SlashOptions

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

Defined in

src/types/handler.ts:18


Transient

Ƭ Transient<T>: () => () => T

Type parameters

Name
T

Type declaration

▸ (): () => T

Returns

fn

▸ (): T

Returns

T

Defined in

src/types/handler.ts:37


VoidResult

Ƭ VoidResult: Result<void, void>

Defined in

src/types/plugin.ts:22

Variables

controller

Const controller: Object

The object passed into every plugin to control a command's behavior

Type declaration

NameType
next() => OkImpl<void>
stop() => ErrImpl<void>

Defined in

src/handler/sern.ts:55


guayin

Const guayin: typeof guayin

Defined in

src/handler/plugins/createPlugin.ts:5

Functions

CommandControlPlugin

CommandControlPlugin<I>(execute): Plugin<unknown[]>

Type parameters

NameType
Iextends CommandType

Parameters

NameType
execute(...args: CommandArgs<I, Event>) => PluginResult

Returns

Plugin<unknown[]>

Defined in

src/handler/plugins/createPlugin.ts:29


CommandInitPlugin

CommandInitPlugin<I>(execute): Plugin<unknown[]>

Type parameters

NameType
Iextends CommandType

Parameters

NameType
execute(...args: CommandArgs<I, Init>) => PluginResult

Returns

Plugin<unknown[]>

Defined in

src/handler/plugins/createPlugin.ts:23


DiscordEventControlPlugin

DiscordEventControlPlugin<T>(name, execute): Plugin<unknown[]>

Experimental

A specialized function for creating control plugins with discord.js ClientEvents. Will probably be moved one day!

Type parameters

NameType
Textends keyof ClientEvents

Parameters

NameType
nameT
execute(...args: ClientEvents[T]) => PluginResult

Returns

Plugin<unknown[]>

Defined in

src/handler/plugins/createPlugin.ts:46


EventControlPlugin

EventControlPlugin<I>(execute): Plugin<unknown[]>

Type parameters

NameType
Iextends EventType

Parameters

NameType
execute(...args: EventArgs<I, Event>) => PluginResult

Returns

Plugin<unknown[]>

Defined in

src/handler/plugins/createPlugin.ts:35


EventInitPlugin

EventInitPlugin<I>(execute): Plugin<unknown[]>

Type parameters

NameType
Iextends EventType

Parameters

NameType
execute(...args: EventArgs<I, Init>) => PluginResult

Returns

Plugin<unknown[]>

Defined in

src/handler/plugins/createPlugin.ts:17


commandModule

commandModule(mod): CommandModule

The wrapper function to define command modules for sern

Parameters

NameType
modInputCommand

Returns

CommandModule

Defined in

src/handler/sern.ts:64


discordEvent

discordEvent<T>(mod): EventModule

Create event modules from discord.js client events, This is an eventModule for discord events, where typings can be very bad.

Type parameters

NameType
Textends keyof ClientEvents

Parameters

NameType
modObject
mod.execute(...args: ClientEvents[T]) => unknown
mod.nameT
mod.plugins?AnyEventPlugin[]

Returns

EventModule

Defined in

src/handler/sern.ts:97


eventModule

eventModule(mod): EventModule

The wrapper function to define event modules for sern

Parameters

NameType
modInputEvent

Returns

EventModule

Defined in

src/handler/sern.ts:79


makePlugin

makePlugin<V>(type, execute): Plugin<V>

Type parameters

NameType
Vextends unknown[]

Parameters

NameType
typePluginType
execute(...args: any[]) => any

Returns

Plugin<V>

Defined in

src/handler/plugins/createPlugin.ts:6


many

many<T>(value): () => () => T

Deprecated

Type parameters

Name
T

Parameters

NameTypeDescription
valueTPlease use the transient function instead

Returns

fn

▸ (): () => T

Returns

fn

▸ (): T

Returns

T

Defined in

src/handler/dependencies/lifetimeFunctions.ts:50


single

single<T>(cb): () => T

Deprecated

Type parameters

NameType
Textends NotFunction

Parameters

NameType
cbT

Returns

fn

▸ (): T

Returns

T

Defined in

src/handler/dependencies/lifetimeFunctions.ts:11

single<T>(cb): T

New signature

Type parameters

NameType
Textends () => unknown

Parameters

NameType
cbT

Returns

T

Defined in

src/handler/dependencies/lifetimeFunctions.ts:16


transient

transient<T>(cb): () => () => T

Deprecated

Type parameters

NameType
Textends NotFunction

Parameters

NameTypeDescription
cbTDeprecated signature

Returns

fn

▸ (): () => T

Returns

fn

▸ (): T

Returns

T

Defined in

src/handler/dependencies/lifetimeFunctions.ts:32

transient<T>(cb): T

Following iti's singleton and transient implementation, use transient if you want a new dependency every time your container getter is called

Type parameters

NameType
Textends () => () => unknown

Parameters

NameType
cbT

Returns

T

Defined in

src/handler/dependencies/lifetimeFunctions.ts:33


useContainerRaw

useContainerRaw<T>(): Container<T, {}>

Returns the underlying data structure holding all dependencies. Please be careful as this only gets the client's current state. Exposes some methods from iti

Type parameters

NameType
Textends Dependencies

Returns

Container<T, {}>

Defined in

src/handler/dependencies/provider.ts:54