25 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
- CommandExecutable
- Context
- DefaultErrorHandling
- DefaultLogging
- DefaultModuleManager
- EventExecutable
- ModuleStore
- SernEmitter
Interfaces
- AutocompleteCommand
- BothCommand
- ButtonCommand
- ChannelSelectCommand
- CommandPlugin
- ContextMenuMsg
- ContextMenuUser
- ControlPlugin
- Controller
- Dependencies
- DependencyConfiguration
- DiscordEventCommand
- ErrorHandling
- EventPlugin
- ExternalEventCommand
- InitArgs
- InitPlugin
- Logging
- MentionableSelectCommand
- ModalSubmitCommand
- Module
- ModuleManager
- Plugin
- RoleSelectCommand
- SernAutocompleteData
- SernEventCommand
- SernSubCommandData
- SernSubCommandGroupData
- SlashCommand
- StringSelectCommand
- TextCommand
- UserSelectCommand
- Wrapper
Type Aliases
AnyCommandPlugin
Ƭ AnyCommandPlugin: ControlPlugin | InitPlugin<[InitArgs<Processed<CommandModule>>]>
Defined in
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
AnyEventPlugin
Ƭ AnyEventPlugin: ControlPlugin | InitPlugin<[InitArgs<Processed<EventModule>>]>
Defined in
AnyModule
Ƭ AnyModule: CommandModule | EventModule
Defined in
Args
Ƭ Args: ParseType<{ slash: SlashOptions ; text: string[] }>
Defined in
AutocompletePlugin
Ƭ AutocompletePlugin: Deprecated<"Please view alternatives: ">
Defined in
BaseOptions
Ƭ BaseOptions: ApplicationCommandChoicesData | ApplicationCommandNonOptionsData | ApplicationCommandChannelOptionData | ApplicationCommandNumericOptionData | ApplicationCommandAttachmentOption | SernAutocompleteData
Type that replaces autocomplete with SernAutocompleteData
Defined in
CommandArgs
Ƭ CommandArgs<I, J>: CommandArgsMatrix[I][J]
Type parameters
| Name | Type |
|---|---|
I |
extends CommandType = CommandType |
J |
extends 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
CommandModuleDefs
Ƭ CommandModuleDefs: Object
Type declaration
| Name | Type |
|---|---|
1 |
TextCommand |
1024 |
RoleSelectCommand |
16 |
ButtonCommand |
2 |
SlashCommand |
2048 |
UserSelectCommand |
256 |
ChannelSelectCommand |
3 |
BothCommand |
32 |
StringSelectCommand |
4 |
ContextMenuUser |
512 |
MentionableSelectCommand |
64 |
ModalSubmitCommand |
8 |
ContextMenuMsg |
Defined in
CommandModuleNoPlugins
Ƭ CommandModuleNoPlugins: { [T in CommandType]: Omit<CommandModuleDefs[T], "plugins" | "onEvent"> }
Defined in
Deprecated
Ƭ Deprecated<Message>: [never, Message]
Type parameters
| Name | Type |
|---|---|
Message |
extends string |
Defined in
DiscordEmitterPlugin
Ƭ DiscordEmitterPlugin: Deprecated<"Please view alternatives: ">
Defined in
DiscordEventPlugin
Ƭ DiscordEventPlugin: Deprecated<"Please view alternatives: ">
Defined in
EventArgs
Ƭ EventArgs<I, J>: EventArgsMatrix[I][J]
Type parameters
| Name | Type |
|---|---|
I |
extends EventType = EventType |
J |
extends PluginType = PluginType |
Defined in
src/handler/plugins/args.ts:113
EventModule
Ƭ EventModule: DiscordEventCommand | SernEventCommand | ExternalEventCommand
Defined in
EventModuleDefs
Ƭ EventModuleDefs: Object
Type declaration
| Name | Type |
|---|---|
1 |
DiscordEventCommand |
2 |
SernEventCommand |
3 |
ExternalEventCommand |
Defined in
EventModulesNoPlugins
Ƭ EventModulesNoPlugins: { [T in EventType]: Omit<EventModuleDefs[T], "plugins" | "onEvent"> }
Defined in
ExternalEmitterPlugin
Ƭ ExternalEmitterPlugin: Deprecated<"Please view alternatives: ">
Defined in
ExternalEventPlugin
Ƭ ExternalEventPlugin: Deprecated<"Please view alternatives: ">
Defined in
InputCommand
Ƭ InputCommand: { [T in CommandType]: CommandModuleNoPlugins[T] & Object }[CommandType]
Defined in
InputEvent
Ƭ InputEvent: { [T in EventType]: EventModulesNoPlugins[T] & Object }[EventType]
Defined in
LogPayload
Ƭ LogPayload<T>: Object
Type parameters
| Name | Type |
|---|---|
T |
unknown |
Type declaration
| Name | Type |
|---|---|
message |
T |
Defined in
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
| Name | Type |
|---|---|
Deps |
extends Dependencies |
T |
extends readonly unknown[] |
Defined in
OptionalDependencies
Ƭ OptionalDependencies: "@sern/logger"
Defined in
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
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
Processed
Ƭ Processed<T>: T & { description: string ; name: string }
Type parameters
| Name |
|---|
T |
Defined in
ReplyOptions
Ƭ ReplyOptions: string | Omit<InteractionReplyOptions, "fetchReply"> | MessageReplyOptions
Defined in
SernEmitterPlugin
Ƭ SernEmitterPlugin: Deprecated<"Please view alternatives: ">
Defined in
SernEventPlugin
Ƭ SernEventPlugin: Deprecated<"Please view alternatives: ">
Defined in
SernEventsMapping
Ƭ SernEventsMapping: Object
Type declaration
| Name | Type |
|---|---|
error |
[Payload] |
module.activate |
[Payload] |
module.register |
[Payload] |
warning |
[Payload] |
Defined in
SernOptionsData
Ƭ SernOptionsData<U>: U extends ApplicationCommandSubCommandData ? SernSubCommandData : U extends ApplicationCommandSubGroupData ? SernSubCommandGroupData : BaseOptions
Type parameters
| Name | Type |
|---|---|
U |
extends ApplicationCommandOptionData = ApplicationCommandOptionData |
Defined in
Singleton
Ƭ Singleton<T>: () => T
Type parameters
| Name |
|---|
T |
Type declaration
▸ (): T
Returns
T
Defined in
SlashOptions
Ƭ SlashOptions: Omit<CommandInteractionOptionResolver, "getMessage" | "getFocused">
Defined in
Transient
Ƭ Transient<T>: () => () => T
Type parameters
| Name |
|---|
T |
Type declaration
▸ (): () => T
Returns
fn
▸ (): T
Returns
T
Defined in
VoidResult
Ƭ VoidResult: Result<void, void>
Defined in
Variables
controller
• Const controller: Object
The object passed into every plugin to control a command's behavior
Type declaration
| Name | Type |
|---|---|
next |
() => OkImpl<void> |
stop |
() => ErrImpl<void> |
Defined in
guayin
• Const guayin: typeof guayin
Defined in
src/handler/plugins/createPlugin.ts:5
Functions
CommandControlPlugin
▸ CommandControlPlugin<I>(execute): Plugin<unknown[]>
Type parameters
| Name | Type |
|---|---|
I |
extends CommandType |
Parameters
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
I |
extends CommandType |
Parameters
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
T |
extends keyof ClientEvents |
Parameters
| Name | Type |
|---|---|
name |
T |
execute |
(...args: ClientEvents[T]) => PluginResult |
Returns
Plugin<unknown[]>
Defined in
src/handler/plugins/createPlugin.ts:46
EventControlPlugin
▸ EventControlPlugin<I>(execute): Plugin<unknown[]>
Type parameters
| Name | Type |
|---|---|
I |
extends EventType |
Parameters
| Name | Type |
|---|---|
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
| Name | Type |
|---|---|
I |
extends EventType |
Parameters
| Name | Type |
|---|---|
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
| 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.
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
The wrapper function to define event modules for sern
Parameters
| Name | Type |
|---|---|
mod |
InputEvent |
Returns
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
src/handler/plugins/createPlugin.ts:6
many
▸ many<T>(value): () => () => T
Deprecated
Type parameters
| Name |
|---|
T |
Parameters
| Name | Type | Description |
|---|---|---|
value |
T |
Please 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
| Name | Type |
|---|---|
T |
extends NotFunction |
Parameters
| Name | Type |
|---|---|
cb |
T |
Returns
fn
▸ (): T
Returns
T
Defined in
src/handler/dependencies/lifetimeFunctions.ts:11
▸ single<T>(cb): T
New signature
Type parameters
| Name | Type |
|---|---|
T |
extends () => unknown |
Parameters
| Name | Type |
|---|---|
cb |
T |
Returns
T
Defined in
src/handler/dependencies/lifetimeFunctions.ts:16
transient
▸ transient<T>(cb): () => () => T
Deprecated
Type parameters
| Name | Type |
|---|---|
T |
extends NotFunction |
Parameters
| Name | Type | Description |
|---|---|---|
cb |
T |
Deprecated 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
| Name | Type |
|---|---|
T |
extends () => () => unknown |
Parameters
| Name | Type |
|---|---|
cb |
T |
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
| Name | Type |
|---|---|
T |
extends Dependencies |
Returns
Container<T, {}>