pub struct CommandRegistry {
pub commands: HashMap<String, Arc<Command>>,
}Expand description
管理并执行指令。
Fields§
§commands: HashMap<String, Arc<Command>>存储指令,将指令名称/别名映射到指令定义。
Implementations§
Source§impl CommandRegistry
impl CommandRegistry
pub fn new() -> Self
Sourcepub fn register(&mut self, command: Command) -> FrameworkResult<()>
pub fn register(&mut self, command: Command) -> FrameworkResult<()>
注册一个指令。 指令的主要名称及其所有别名都将被注册。
Sourcepub async fn parse_and_execute(
&self,
session: Arc<Session>,
message_content: &str,
prefixes: &[&str],
) -> FrameworkResult<bool>
pub async fn parse_and_execute( &self, session: Arc<Session>, message_content: &str, prefixes: &[&str], ) -> FrameworkResult<bool>
Trait Implementations§
Source§impl Debug for CommandRegistry
impl Debug for CommandRegistry
Source§impl Default for CommandRegistry
impl Default for CommandRegistry
Source§fn default() -> CommandRegistry
fn default() -> CommandRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for CommandRegistry
impl !UnwindSafe for CommandRegistry
impl Freeze for CommandRegistry
impl Send for CommandRegistry
impl Sync for CommandRegistry
impl Unpin for CommandRegistry
impl UnsafeUnpin for CommandRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more