CommandControlPlugin
CommandControlPlugin<
I
>(execute
):Plugin
<unknown
[]>
Creates a control plugin for command preprocessing, filtering, and state management
Type parameters
• I extends CommandType
Extends CommandType to enforce type safety for command modules
Parameters
• execute
Function to execute during command control flow
Returns
Plugin
<unknown
[]>
A plugin that runs during command execution flow
Since
2.5.0
Example
Example
Remarks
- Control plugins are executed in order when a discord.js event is emitted
- Use controller.next() to continue to next plugin or controller.stop() to halt execution
- State can be passed between plugins using controller.next({ key: value })
- State keys should be namespaced to avoid collisions (e.g., ‘plugin-name/key’)
- Final accumulated state is passed to the command’s execute function
- All plugins must succeed for the command to execute
- Plugins have access to dependencies through the sdt.deps object
- Useful for implementing preconditions, filters, and command preprocessing