Files
website/docs/api/modules.md
2022-12-28 22:43:41 +03:00

16 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

Interfaces

Type Aliases

AnyDefinedModule

Ƭ AnyDefinedModule: DefinedCommandModule | DefinedEventModule

Defined in

src/types/handler.ts:25


AnyModule

Ƭ AnyModule: CommandModule | EventModule

Defined in

src/types/module.ts:153


Args

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

Defined in

src/types/handler.ts:15


BaseOptions

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

Type that replaces autocomplete with SernAutocompleteData

Defined in

src/types/module.ts:190


CommandModule

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

Defined in

src/types/module.ts:139


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

src/types/module.ts:157


CommandModuleNoPlugins

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

Defined in

src/handler/plugins/plugin.ts:108


CommandModulePlugin

Ƭ CommandModulePlugin<T>: EventPlugin<T> | CommandPlugin<T>

Type parameters

Name Type
T extends CommandType

Defined in

src/handler/plugins/plugin.ts:136


DefinedCommandModule

Ƭ DefinedCommandModule: CommandModule & { description: string ; name: string }

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


DefinedEventModule

Ƭ DefinedEventModule: EventModule & { name: string }

Defined in

src/types/handler.ts:24


EventModule

Ƭ EventModule: DiscordEventCommand | SernEventCommand | ExternalEventCommand

Defined in

src/types/module.ts:138


EventModuleCommandPluginDefs

Ƭ EventModuleCommandPluginDefs: Object

Event Module Command Plugins

Type declaration

Name Type
1 DiscordEmitterPlugin
2 SernEmitterPlugin
3 ExternalEmitterPlugin

Defined in

src/handler/plugins/plugin.ts:126


EventModuleDefs

Ƭ EventModuleDefs: Object

Type declaration

Name Type
1 DiscordEventCommand
2 SernEventCommand
3 ExternalEventCommand

Defined in

src/types/module.ts:172


EventModuleEventPluginDefs

Ƭ EventModuleEventPluginDefs: Object

Event Module Event Plugins

Type declaration

Name Type
1 DiscordEventPlugin
2 SernEventPlugin
3 ExternalEventPlugin

Defined in

src/handler/plugins/plugin.ts:117


EventModulePlugin

Ƭ EventModulePlugin<T>: EventModuleEventPluginDefs[T] | EventModuleCommandPluginDefs[T]

Type parameters

Name Type
T extends EventType

Defined in

src/handler/plugins/plugin.ts:132


EventModulesNoPlugins

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

Defined in

src/handler/plugins/plugin.ts:111


InputCommandModule

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

User inputs this type. Sern processes behind the scenes for better usage

Defined in

src/handler/plugins/plugin.ts:141


InputEventModule

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

Defined in

src/handler/plugins/plugin.ts:145


LogPayload

Ƭ LogPayload<T>: Object

Type parameters

Name Type
T unknown

Type declaration

Name Type
message T

Defined in

src/types/handler.ts:36


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

src/types/handler.ts:51


OptionalDependencies

Ƭ OptionalDependencies: "@sern/logger"

Defined in

src/types/handler.ts:57


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


Payload

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

Defined in

src/types/handler.ts:26


ReplyOptions

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

Defined in

src/types/handler.ts:49


SernEventsMapping

Ƭ SernEventsMapping: Object

Type declaration

Name Type
error [Payload]
module.activate [Payload]
module.register [Payload]
warning [Payload]

Defined in

src/types/handler.ts:30


SernOptionsData

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

Type parameters

Name Type
U extends ApplicationCommandOptionData = ApplicationCommandOptionData

Defined in

src/types/module.ts:210


Singleton

Ƭ Singleton<T>: () => T

Type parameters

Name
T

Type declaration

▸ (): T

Returns

T

Defined in

src/types/handler.ts:37


SlashOptions

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

Defined in

src/types/handler.ts:17


Transient

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

Type parameters

Name
T

Type declaration

▸ (): () => T

Returns

fn

▸ (): T

Returns

T

Defined in

src/types/handler.ts:38

Functions

commandModule

commandModule(mod): CommandModule

The wrapper function to define command modules for sern

Parameters

Name Type
mod InputCommandModule

Returns

CommandModule

Defined in

src/handler/sern.ts:64


eventModule

eventModule(mod): EventModule

The wrapper function to define event modules for sern

Parameters

Name Type
mod InputEventModule

Returns

EventModule

Defined in

src/handler/sern.ts:76


many

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

A function that returns another function Used for transient in iti

Type parameters

Name
T

Parameters

Name Type
value T

Returns

fn

▸ (): () => T

Returns

fn

▸ (): T

Returns

T

Defined in

src/handler/utilities/functions.ts:16


single

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

A function that returns whatever value is provided. Used for singleton in iti

Type parameters

Name
T

Parameters

Name Type
value T

Returns

fn

▸ (): T

Returns

T

Defined in

src/handler/utilities/functions.ts:10


useContainerRaw

useContainerRaw(): null | Container<Dependencies, Partial<Dependencies>>

Returns the underlying data structure holding all dependencies. Exposes some methods from iti

Returns

null | Container<Dependencies, Partial<Dependencies>>

Defined in

src/handler/dependencies/provider.ts:74