Skip to main content

@sern/handler

Namespaces

Enumerations

Classes

Interfaces

References

controller

Re-exports controller

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


EventModule

Ƭ EventModule: DiscordEventCommand | SernEventCommand | ExternalEventCommand

Defined in

src/types/core-modules.ts:130


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


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

Functions

CommandControlPlugin

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

Since

2.5.0 @PURE

Type parameters

NameType
Iextends CommandType

Parameters

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

Returns

Plugin<unknown[]>

Defined in

src/core/create-plugins.ts:36


CommandInitPlugin

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

Since

2.5.0 @PURE

Type parameters

NameType
Iextends CommandType

Parameters

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

Returns

Plugin<unknown[]>

Defined in

src/core/create-plugins.ts:27


DiscordEventControlPlugin

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

Since

2.5.0

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


EventControlPlugin

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

Since

2.5.0 @PURE

Type parameters

NameType
Iextends EventType

Parameters

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

Returns

Plugin<unknown[]>

Defined in

src/core/create-plugins.ts:45


EventInitPlugin

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

Since

2.5.0 @PURE

Type parameters

NameType
Iextends EventType

Parameters

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

Returns

Plugin<unknown[]>

Defined in

src/core/create-plugins.ts:18


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.

Since

3.0.0

Example

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

Type parameters

NameType
Textends keyof Dependencies

Parameters

NameTypeDescription
keyTa key that corresponds to a dependency registered.

Returns

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

Defined in

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


Services

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

Since

3.0.0 The plural version of Service

Type parameters

NameType
Textends keyof Dependencies[]

Parameters

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

Returns

IntoDependencies<T>

array of dependencies, in the same order of keys provided

Defined in

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


commandModule

commandModule(mod): CommandModule

Since

1.0.0 The wrapper function to define command modules for sern

Parameters

NameType
modInputCommand

Returns

CommandModule

Defined in

src/core/modules.ts:25


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.

Experimental

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/core/modules.ts:53


eventModule

eventModule(mod): EventModule

Since

1.0.0 The wrapper function to define event modules for sern

Parameters

NameType
modInputEvent

Returns

EventModule

Defined in

src/core/modules.ts:38


makeDependencies

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

Since

2.0.0

Type parameters

NameType
Textends Dependencies

Parameters

NameTypeDescription
confDependencyConfigurationa configuration for creating your project dependencies

Returns

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

Defined in

src/core/ioc/base.ts:27


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


single

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

@PURE

Since

2.0.0. Creates a singleton object.

Type parameters

Name
T

Parameters

NameType
cb() => T

Returns

fn

▸ (): T

Returns

T

Defined in

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


transient

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

@PURE

Since

2.0.0 Creates a transient object

Type parameters

Name
T

Parameters

NameType
cb() => () => T

Returns

fn

▸ (): () => T

Returns

fn

▸ (): T

Returns

T

Defined in

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


useContainerRaw

useContainerRaw(): CoreContainer<Partial<Dependencies>>

Deprecated

Returns the underlying data structure holding all dependencies. Exposes methods from iti Use the Service API. The container should be readonly

Returns

CoreContainer<Partial<Dependencies>>

Defined in

src/core/ioc/base.ts:15