Skip to main content

@sern/handler

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

AnyCommandPlugin

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

Defined in

src/types/core-plugin.ts:76


AnyEventPlugin

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

Defined in

src/types/core-plugin.ts:77


Args

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

Defined in

src/types/utility.ts:16


CommandModule

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

Defined in

src/types/core-modules.ts:132


EventModule

Ƭ EventModule: DiscordEventCommand | SernEventCommand | ExternalEventCommand

Defined in

src/types/core-modules.ts:131


Initializable

Ƭ Initializable<T>: T

Type to annotate that something is initializable. If T has an init method, this will be called.

Type parameters

NameType
Textends Init

Defined in

src/types/ioc.ts:17


LogPayload

Ƭ LogPayload<T>: Object

Type parameters

NameType
Tunknown

Type declaration

NameType
messageT

Defined in

src/core/contracts/logging.ts:11


Payload

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

Defined in

src/types/utility.ts:26


PluginResult

Ƭ PluginResult: Awaitable<VoidResult>

Defined in

src/types/core-plugin.ts:51


SernOptionsData

Ƭ SernOptionsData: SernSubCommandData | SernSubCommandGroupData | APIApplicationCommandBasicOption | SernAutocompleteData

Type that replaces autocomplete with SernAutocompleteData

Defined in

src/types/core-modules.ts:200


Singleton

Ƭ Singleton<T>: () => T

Type parameters

Name
T

Type declaration

▸ (): T

Type to annotate that something is a singleton. T is created once and lazily.

Returns

T

Defined in

src/types/ioc.ts:7


SlashOptions

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

Defined in

src/types/utility.ts:14


Transient

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

Type parameters

Name
T

Type declaration

▸ (): () => T

Type to annotate that something is transient. Every time this is called, a new object is created

Returns

fn

▸ (): T

Returns

T

Defined in

src/types/ioc.ts:12

Variables

controller

Const controller: Object

Since

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

Type declaration

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

Defined in

src/core/create-plugins.ts:69

Functions

CommandControlPlugin

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

Type parameters

NameType
Iextends CommandType

Parameters

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

Returns

Plugin<unknown[]>

Since

2.5.0 @PURE

Defined in

src/core/create-plugins.ts:37


CommandInitPlugin

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

Type parameters

NameType
Iextends CommandType

Parameters

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

Returns

Plugin<unknown[]>

Since

2.5.0 @PURE

Defined in

src/core/create-plugins.ts:28


DiscordEventControlPlugin

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

Type parameters

NameType
Textends keyof ClientEvents

Parameters

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

Returns

Plugin<unknown[]>

Since

2.5.0

Experimental

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

Defined in

src/core/create-plugins.ts:58


EventControlPlugin

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

Type parameters

NameType
Iextends EventType

Parameters

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

Returns

Plugin<unknown[]>

Since

2.5.0 @PURE

Defined in

src/core/create-plugins.ts:46


EventInitPlugin

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

Type parameters

NameType
Iextends EventType

Parameters

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

Returns

Plugin<unknown[]>

Since

2.5.0 @PURE

Defined in

src/core/create-plugins.ts:19


Service

Service<T>(key): NonNullable<UnpackFunction<Partial<Dependencies>[T]>>

The new Service api, a cleaner alternative to useContainer To obtain intellisense, ensure a .d.ts file exists in the root of compilation. Usually our scaffolding tool takes care of this. Note: this method only works AFTER your container has been initiated

Type parameters

NameType
Textends keyof Dependencies

Parameters

NameTypeDescription
keyTa key that corresponds to a dependency registered.

Returns

NonNullable<UnpackFunction<Partial<Dependencies>[T]>>

Since

3.0.0

Example

const client = Service('@sern/client');

Defined in

src/core/ioc/dependency-injection.ts:37


Services

Services<T>(...keys): IntoDependencies<T>

Type parameters

NameType
Textends keyof Dependencies[]

Parameters

NameType
...keys[...T[]]

Returns

IntoDependencies<T>

array of dependencies, in the same order of keys provided

Since

3.0.0 The plural version of Service

Defined in

src/core/ioc/dependency-injection.ts:47


commandModule

commandModule(mod): CommandModule

Parameters

NameType
modInputCommand

Returns

CommandModule

Since

1.0.0 The wrapper function to define command modules for sern

Defined in

src/core/modules.ts:19


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

Experimental

Defined in

src/core/modules.ts:47


eventModule

eventModule(mod): EventModule

Parameters

NameType
modInputEvent

Returns

EventModule

Since

1.0.0 The wrapper function to define event modules for sern

Defined in

src/core/modules.ts:32


makeDependencies

makeDependencies<T>(conf): Promise<<V>(...keys: [...V[]]) => IntoDependencies<V>>

Type parameters

NameType
Textends Dependencies

Parameters

NameType
confValidDependencyConfig

Returns

Promise<<V>(...keys: [...V[]]) => IntoDependencies<V>>

Defined in

src/core/ioc/base.ts:144


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/core/create-plugins.ts:6


single

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

@PURE

Type parameters

Name
T

Parameters

NameType
cb() => T

Returns

fn

▸ (): T

Returns

T

Since

2.0.0. Creates a singleton object.

Defined in

src/core/ioc/dependency-injection.ts:11


transient

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

@PURE

Type parameters

Name
T

Parameters

NameType
cb() => () => T

Returns

fn

▸ (): () => T

Returns

fn

▸ (): T

Returns

T

Since

2.0.0 Creates a transient object

Defined in

src/core/ioc/dependency-injection.ts:21