pub trait Command:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &str;
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 MessageContext<'_>,
) -> Pin<Box<dyn Future<Output = Result<CommandAction>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn description(&self) -> Option<&str> { ... }
fn args(&self) -> Vec<Arg<'_>> { ... }
fn priority(&self) -> u32 { ... }
fn alias(&self) -> Vec<&str> { ... }
fn permission(&self) -> Permission { ... }
}Expand description
命令行为接口。
Required Methods§
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 MessageContext<'_>,
) -> Pin<Box<dyn Future<Output = Result<CommandAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 MessageContext<'_>,
) -> Pin<Box<dyn Future<Output = Result<CommandAction>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
执行命令。
Provided Methods§
Sourcefn description(&self) -> Option<&str>
fn description(&self) -> Option<&str>
返回命令描述。
Sourcefn permission(&self) -> Permission
fn permission(&self) -> Permission
返回命令权限,默认为 Permission::All。