@sern/handler
Namespaces
Enumerations
Classes
- CommandExecutable
- Context
- DefaultErrorHandling
- DefaultLogging
- DefaultModuleManager
- EventExecutable
- ModuleStore
- SernEmitter
Interfaces
- BothCommand
- ButtonCommand
- ChannelSelectCommand
- CommandModuleDefs
- ContextMenuMsg
- ContextMenuUser
- ControlPlugin
- Controller
- CoreDependencies
- CoreModuleStore
- DiscordEventCommand
- Disposable
- Emitter
- ErrorHandling
- EventModuleDefs
- ExternalEventCommand
- Init
- InitPlugin
- Logging
- MentionableSelectCommand
- ModalSubmitCommand
- ModuleManager
- Plugin
- RoleSelectCommand
- SernAutocompleteData
- SernEventCommand
- SernEventsMapping
- SernSubCommandData
- SernSubCommandGroupData
- SlashCommand
- StringSelectCommand
- TextCommand
- UserSelectCommand
- Wrapper
References
controller
Re-exports controller
Type Aliases
AnyCommandPlugin
Ƭ AnyCommandPlugin: ControlPlugin
| InitPlugin
<[InitArgs
<Processed
<CommandModule
>>]>
Defined in
AnyEventPlugin
Ƭ AnyEventPlugin: ControlPlugin
| InitPlugin
<[InitArgs
<Processed
<EventModule
>>]>
Defined in
Args
Ƭ Args: ParseType
<{ slash
: SlashOptions
; text
: string
[] }>
Defined in
CommandModule
Ƭ CommandModule: TextCommand
| SlashCommand
| BothCommand
| ContextMenuUser
| ContextMenuMsg
| ButtonCommand
| StringSelectCommand
| MentionableSelectCommand
| UserSelectCommand
| ChannelSelectCommand
| RoleSelectCommand
| ModalSubmitCommand
Defined in
EventModule
Ƭ EventModule: DiscordEventCommand
| SernEventCommand
| ExternalEventCommand
Defined in
Initializable
Ƭ Initializable<T
>: T
Type to annotate that something is initializable. If T has an init method, this will be called.
Type parameters
Name | Type |
---|---|
T | extends Init |
Defined in
LogPayload
Ƭ LogPayload<T
>: Object
Type parameters
Name | Type |
---|---|
T | unknown |
Type declaration
Name | Type |
---|---|
message | T |
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
PluginResult
Ƭ PluginResult: Awaitable
<VoidResult
>
Defined in
SernOptionsData
Ƭ SernOptionsData: SernSubCommandData
| SernSubCommandGroupData
| APIApplicationCommandBasicOption
| SernAutocompleteData
Type that replaces autocomplete with SernAutocompleteData
Defined in
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
SlashOptions
Ƭ SlashOptions: Omit
<CommandInteractionOptionResolver
, "getMessage"
| "getFocused"
>
Defined in
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
Functions
CommandControlPlugin
▸ CommandControlPlugin<I
>(execute
): Plugin
<unknown
[]>
Since
2.5.0 @PURE
Type parameters
Name | Type |
---|---|
I | extends CommandType |
Parameters
Name | Type |
---|---|
execute | (...args : CommandArgs <I , Control >) => PluginResult |
Returns
Plugin
<unknown
[]>
Defined in
CommandInitPlugin
▸ CommandInitPlugin<I
>(execute
): Plugin
<unknown
[]>
Since
2.5.0 @PURE
Type parameters
Name | Type |
---|---|
I | extends CommandType |
Parameters
Name | Type |
---|---|
execute | (...args : CommandArgs <I , Init >) => PluginResult |
Returns
Plugin
<unknown
[]>
Defined in
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
Name | Type |
---|---|
T | extends keyof ClientEvents |
Parameters
Name | Type |
---|---|
name | T |
execute | (...args : ClientEvents [T ]) => PluginResult |
Returns
Plugin
<unknown
[]>
Defined in
EventControlPlugin
▸ EventControlPlugin<I
>(execute
): Plugin
<unknown
[]>
Since
2.5.0 @PURE
Type parameters
Name | Type |
---|---|
I | extends EventType |
Parameters
Name | Type |
---|---|
execute | (...args : EventArgs <I , Control >) => PluginResult |
Returns
Plugin
<unknown
[]>
Defined in
EventInitPlugin
▸ EventInitPlugin<I
>(execute
): Plugin
<unknown
[]>
Since
2.5.0 @PURE
Type parameters
Name | Type |
---|---|
I | extends EventType |
Parameters
Name | Type |
---|---|
execute | (...args : EventArgs <I , Init >) => PluginResult |
Returns
Plugin
<unknown
[]>
Defined in
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
Name | Type |
---|---|
T | extends keyof Dependencies |
Parameters
Name | Type | Description |
---|---|---|
key | T | a 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
Name | Type |
---|---|
T | extends keyof Dependencies [] |
Parameters
Name | Type |
---|---|
...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
Name | Type |
---|---|
mod | InputCommand |
Returns
Defined in
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
Name | Type |
---|---|
T | extends keyof ClientEvents |
Parameters
Name | Type |
---|---|
mod | Object |
mod.execute | (...args : ClientEvents [T ]) => unknown |
mod.name | T |
mod.plugins? | AnyEventPlugin [] |
Returns
Defined in
eventModule
▸ eventModule(mod
): EventModule
Since
1.0.0 The wrapper function to define event modules for sern
Parameters
Name | Type |
---|---|
mod | InputEvent |
Returns
Defined in
makeDependencies
▸ makeDependencies<T
>(conf
): Promise
<<V>(...keys
: [...V[]]) => IntoDependencies
<V
>>
Since
2.0.0
Type parameters
Name | Type |
---|---|
T | extends Dependencies |
Parameters
Name | Type | Description |
---|---|---|
conf | DependencyConfiguration | a configuration for creating your project dependencies |
Returns
Promise
<<V>(...keys
: [...V[]]) => IntoDependencies
<V
>>
Defined in
makePlugin
▸ makePlugin<V
>(type
, execute
): Plugin
<V
>
Type parameters
Name | Type |
---|---|
V | extends unknown [] |
Parameters
Name | Type |
---|---|
type | PluginType |
execute | (...args : any []) => any |
Returns
Plugin
<V
>
Defined in
single
▸ single<T
>(cb
): () => T
@PURE
Since
2.0.0. Creates a singleton object.
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
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
>>