Skip to main content
Version: Next

RuntimePlugin

RuntimePlugin extends PluginCommon<T, CommandKitPluginRuntime>

new RuntimePlugin(options)
ParameterTypeOptional
optionsT

Properties

public name: any

public options: any

Methods

public activate(ctx): Promise<void>

Called when this plugin is activated

ParameterTypeOptional
ctxCommandKitPluginRuntime

public deactivate(ctx): Promise<void>

Called when this plugin is deactivated

ParameterTypeOptional
ctxCommandKitPluginRuntime

public executeCommand(ctx, env, source, command, execute): Promise<boolean>

Called before command is executed. This method can execute the command itself.

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeN/A
envCommandKitEnvironmentN/A
sourceInteractionMessage
commandPreparedAppCommandExecutionThe command
execute( ...argsunknown[] ) => Promise<any>

public onAfterClientLogin(ctx): Promise<void>

Called after the client logs in

ParameterTypeOptional
ctxCommandKitPluginRuntime

public onAfterCommand(ctx, env): Promise<void>

Called after command and all of its deferred functions are executed.

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeThe context
envCommandKitEnvironmentThe environment of the command. This environment contains the command execution data such as command context and more.

public onAfterCommandsLoad(ctx): Promise<void>

Called after commands are loaded

ParameterTypeOptional
ctxCommandKitPluginRuntime

public onAfterEventsLoad(ctx): Promise<void>

Called after events are loaded

ParameterTypeOptional
ctxCommandKitPluginRuntime

public onBeforeClientLogin(ctx): Promise<void>

Called before the client logs in

ParameterTypeOptional
ctxCommandKitPluginRuntime

public onBeforeCommandsLoad(ctx): Promise<void>

Called before commands are loaded

ParameterTypeOptional
ctxCommandKitPluginRuntime

public onBeforeEventsLoad(ctx): Promise<void>

Called before events are loaded

ParameterTypeOptional
ctxCommandKitPluginRuntime

public onBeforeInteraction(ctx, interaction): Promise<void>

Called before interaction is handled

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeN/A
interactionInteractionThe interaction

public onBeforeMessageCommand(ctx, message): Promise<void>

Called before message command is processed

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeN/A
messageMessageThe message

public onBeforePrepareGuildCommandsRegistration(ctx, event): 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.

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeThe context
eventPreRegisterCommandsEventThe command registration data

public onBeforeRegisterCommands(ctx, event): Promise<void>

Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeThe context
eventPreRegisterCommandsEventN/A

public onBeforeRegisterGlobalCommands(ctx, event): 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.

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeThe context
eventPreRegisterCommandsEventThe command registration data

public onBeforeRegisterGuildCommands(ctx, event): 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.

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeThe context
eventPreRegisterCommandsEventThe command registration data

public onCommandsRouterInit(ctx): Promise<void>

Called after commands router is initialized

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeThe context

public onEventsRouterInit(ctx): Promise<void>

Called after events router is initialized

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeThe context

public performHMR(ctx, event): Promise<void>

Called when HMR event is received

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeThe context
eventCommandKitHMREventThe event

public prepareCommand(ctx, commands): Promise<null | CommandBuilderLike>

Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.

ParameterTypeOptionalDescription
ctxCommandKitPluginRuntimeThe context
commandsCommandBuilderLikeThe command that is being loaded. This is a CommandBuilderLike object which represents Discord's command