Skip to main content
Version: 1.x

RateLimitPlugin

RateLimitPlugin

Runtime plugin that enforces rate limits for CommandKit commands so handlers stay lean.

Signature
class RateLimitPlugin extends RuntimePlugin<RateLimitPluginOptions> {
public readonly name = 'RateLimitPlugin';
constructor(options: RateLimitPluginOptions)
activate(ctx: CommandKitPluginRuntime) => Promise<void>;
deactivate() => Promise<void>;
executeCommand(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment, source: Interaction | Message, prepared: PreparedAppCommandExecution, execute: () => Promise<any>) => Promise<boolean>;
performHMR(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent) => Promise<void>;
}

name

property

constructor

method
(options: RateLimitPluginOptions) => RateLimitPlugin

activate

method
(ctx: CommandKitPluginRuntime) => Promise<void>

Initialize runtime storage and defaults for this plugin instance.

deactivate

method
() => Promise<void>

Dispose queues and clear shared runtime state.

executeCommand

method
(ctx: CommandKitPluginRuntime, env: CommandKitEnvironment, source: Interaction | Message, prepared: PreparedAppCommandExecution, execute: () => Promise<any>) => Promise<boolean>

Evaluate rate limits and optionally queue execution to avoid dropping commands.

performHMR

method
(ctx: CommandKitPluginRuntime, event: CommandKitHMREvent) => Promise<void>

Clear matching keys when a command is hot-reloaded to avoid stale state.