RuntimePlugin
RuntimePlugin
CommandKit plugin that runs at the runtime.
class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CommandKitPluginRuntime> {
public readonly type = PluginType.Runtime;
onBeforeCommandsLoad(ctx: CommandKitPluginRuntime) => Promise<void>;
onAfterCommandsLoad(ctx: CommandKitPluginRuntime) => Promise<void>;
onBeforeEventsLoad(ctx: CommandKitPluginRuntime) => Promise<void>;
onAfterEventsLoad(ctx: CommandKitPluginRuntime) => Promise<void>;
onBeforeClientLogin(ctx: CommandKitPluginRuntime) => Promise<void>;
onAfterClientLogin(ctx: CommandKitPluginRuntime) => Promise<void>;
onBeforeInteraction(ctx: CommandKitPluginRuntime, interaction: Interaction) => Promise<void>;
onBeforeMessageCommand(ctx: CommandKitPluginRuntime, message: Message) => Promise<void>;
executeCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment, source: Interaction | Message, command: PreparedAppCommandExecution, execute: () => Promise<any>) => Promise<boolean>;
onEventsRouterInit(ctx: CommandKitPluginRuntime) => Promise<void>;
onCommandsRouterInit(ctx: CommandKitPluginRuntime) => Promise<void>;
performHMR(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent) => Promise<void>;
prepareCommand(ctx: CommandKitPluginRuntime, commands: CommandBuilderLike) => Promise<CommandBuilderLike | null>;
onBeforeRegisterCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent) => Promise<void>;
onBeforeRegisterGlobalCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent) => Promise<void>;
onBeforePrepareGuildCommandsRegistration(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent) => Promise<void>;
onBeforeRegisterGuildCommands(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent) => Promise<void>;
onAfterCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment) => ;
willEmitEvent(ctx: CommandKitPluginRuntime, event: CommandKitEventDispatch) => ;
}
- Extends:
PluginCommon<T, CommandKitPluginRuntime>
type
onBeforeCommandsLoad
(ctx: CommandKitPluginRuntime) => Promise<void>
Called before commands are loaded
onAfterCommandsLoad
(ctx: CommandKitPluginRuntime) => Promise<void>
Called after commands are loaded
onBeforeEventsLoad
(ctx: CommandKitPluginRuntime) => Promise<void>
Called before events are loaded
onAfterEventsLoad
(ctx: CommandKitPluginRuntime) => Promise<void>
Called after events are loaded
onBeforeClientLogin
(ctx: CommandKitPluginRuntime) => Promise<void>
Called before the client logs in
onAfterClientLogin
(ctx: CommandKitPluginRuntime) => Promise<void>
Called after the client logs in
onBeforeInteraction
(ctx: CommandKitPluginRuntime, interaction: Interaction) => Promise<void>
Called before interaction is handled
onBeforeMessageCommand
(ctx: CommandKitPluginRuntime, message: Message) => Promise<void>
Called before message command is processed
executeCommand
(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment, source: Interaction | Message, command: PreparedAppCommandExecution, execute: () => Promise<any>) => Promise<boolean>
Called before command is executed. This method can execute the command itself.
onEventsRouterInit
(ctx: CommandKitPluginRuntime) => Promise<void>
Called after events router is initialized
onCommandsRouterInit
(ctx: CommandKitPluginRuntime) => Promise<void>
Called after commands router is initialized
performHMR
(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent) => Promise<void>
Called when HMR event is received
prepareCommand
(ctx: CommandKitPluginRuntime, commands: CommandBuilderLike) => Promise<CommandBuilderLike | null>
Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.
onBeforeRegisterCommands
(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent) => Promise<void>
Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.
onBeforeRegisterGlobalCommands
(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent) => Promise<void>
Called before global commands registration. This method can cancel the registration of the command and handle it manually.
This method is called after onBeforeRegisterCommands
if that stage was not handled.
onBeforePrepareGuildCommandsRegistration
(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent) => Promise<void>
Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
This method is called before guilds of the command are resolved. It is called after onBeforeRegisterCommands
if that stage was not handled.
onBeforeRegisterGuildCommands
(ctx: CommandKitPluginRuntime, event: PreRegisterCommandsEvent) => Promise<void>
Called before guild commands registration. This method can cancel the registration of the command and handle it manually.
This method is called after guilds of the command are resolved. It is called after onBeforePrepareGuildCommandsRegistration
if that stage was not handled.
onAfterCommand
(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment) =>
Called after command and all of its deferred functions are executed.
willEmitEvent
(ctx: CommandKitPluginRuntime, event: CommandKitEventDispatch) =>
Called before emitting an event