pub trait Plugin: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn commands(&self) -> Vec<CommandInfo>;
fn handle(&self, ctx: CommandContext) -> BoxFuture<'_, Result<PluginResult>>;
}Expand description
A plugin that handles one or more / commands.
Implement this trait and register it with PluginRegistry to add
custom commands to a room broker. The broker dispatches matching
Message::Command messages to the plugin’s handle
method.
Required Methods§
Sourcefn commands(&self) -> Vec<CommandInfo>
fn commands(&self) -> Vec<CommandInfo>
Commands this plugin handles. Each entry drives /help output
and TUI autocomplete.
Sourcefn handle(&self, ctx: CommandContext) -> BoxFuture<'_, Result<PluginResult>>
fn handle(&self, ctx: CommandContext) -> BoxFuture<'_, Result<PluginResult>>
Handle an invocation of one of this plugin’s commands.
Returns a boxed future for dyn compatibility (required because the
registry stores Box<dyn Plugin>).