pub struct Context {
pub bots: Arc<Mutex<Vec<Arc<Bot>>>>,
pub current_filter: ContextFilter,
pub shared_state: Arc<RwLock<EventSystemSharedState>>,
}Fields§
§bots: Arc<Mutex<Vec<Arc<Bot>>>>当前应用的全部机器人实例
current_filter: ContextFilter当前上下文的过滤器设置
对共享状态的引用
Implementations§
Source§impl Context
impl Context
pub fn new_root(shared_state: Arc<RwLock<EventSystemSharedState>>) -> Self
pub fn user(&self, user_id: &str) -> Self
pub fn guild(&self, guild_id: &str) -> Self
pub fn platform(&self, platform: &str) -> Self
pub fn private(&self) -> Self
pub fn group(&self) -> Self
Sourcepub fn command(&self, name: &str) -> CommandBuilder
pub fn command(&self, name: &str) -> CommandBuilder
pub fn on<F>(&self, event_name: &str, callback: F) -> ListenerHandle
pub fn once<F>(&self, event_name: &str, callback: F) -> ListenerHandle
pub fn bail<F>(&self, event_name: &str, callback: F) -> ListenerHandle
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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