aionbot_core/
lib.rs

1pub mod entry;
2pub mod event;
3pub mod handler;
4pub mod plugin;
5pub mod prelude;
6pub mod queue;
7pub mod router {
8    use crate::event::Event;
9
10    pub trait Router: Send + Sync {
11        fn matches(&self, event: &dyn Event) -> bool;
12    }
13
14    impl<T> Router for T
15    where
16        T: Send + Sync + AsRef<str> + 'static,
17    {
18        fn matches(&self, event: &dyn Event) -> bool {
19            if let Ok(val) = event.content().downcast::<&str>() {
20                *val == self.as_ref()
21            } else {
22                false
23            }
24        }
25    }
26
27    mod command;
28    mod error;
29    mod logic;
30    mod matcher;
31
32    pub use command::CommandRouter;
33    pub use error::ErrorRouter;
34    pub use logic::{AllRouter, AnyRouter};
35    pub use matcher::{ContainsRouter, EndsWithRouter, ExactMatchRouter, StartsWithRouter};
36}
37pub mod runtime;
38pub mod types;