pub trait Plugin: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn version(&self) -> &str;
fn capabilities(&self) -> Vec<Capability>;
fn process<'life0, 'async_trait>(
&'life0 self,
request: PluginRequest,
) -> Pin<Box<dyn Future<Output = Result<PluginResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn description(&self) -> &str { ... }
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
_config: PluginConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn can_handle(&self, _message: &Message) -> bool { ... }
fn metadata(&self) -> PluginMetadata { ... }
}Expand description
Plugin trait for extending bot functionality
Required Methods§
Sourcefn capabilities(&self) -> Vec<Capability>
fn capabilities(&self) -> Vec<Capability>
Get plugin capabilities
Sourcefn process<'life0, 'async_trait>(
&'life0 self,
request: PluginRequest,
) -> Pin<Box<dyn Future<Output = Result<PluginResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process<'life0, 'async_trait>(
&'life0 self,
request: PluginRequest,
) -> Pin<Box<dyn Future<Output = Result<PluginResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Process a request
Provided Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
Get plugin description
Sourcefn initialize<'life0, 'async_trait>(
&'life0 mut self,
_config: PluginConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn initialize<'life0, 'async_trait>(
&'life0 mut self,
_config: PluginConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Initialize the plugin
Sourcefn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Shutdown the plugin
Sourcefn can_handle(&self, _message: &Message) -> bool
fn can_handle(&self, _message: &Message) -> bool
Check if the plugin can handle a message
Sourcefn metadata(&self) -> PluginMetadata
fn metadata(&self) -> PluginMetadata
Get plugin metadata