diff options
Diffstat (limited to 'src/feature/mod.rs')
| -rw-r--r-- | src/feature/mod.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/feature/mod.rs b/src/feature/mod.rs new file mode 100644 index 0000000..5e00620 --- /dev/null +++ b/src/feature/mod.rs | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | use std::boxed::Box; | ||
| 2 | use std::error::Error; | ||
| 3 | |||
| 4 | extern crate telegram_bot; | ||
| 5 | use telegram_bot::{Api, Message}; | ||
| 6 | |||
| 7 | pub mod jisoku; | ||
| 8 | pub mod tasterank; | ||
| 9 | |||
| 10 | pub enum FeatureResult { | ||
| 11 | Handled, | ||
| 12 | Skip, | ||
| 13 | } | ||
| 14 | |||
| 15 | pub trait Feature { | ||
| 16 | fn name(&self) -> &'static str; | ||
| 17 | fn init(&mut self); | ||
| 18 | fn handle(&mut self, Api, Message) -> Result<FeatureResult, String>; | ||
| 19 | } | ||
| 20 | |||
| 21 | pub fn init() -> Vec<Box<Feature>> { | ||
| 22 | vec![Box::new(tasterank::Tasterank::new()), Box::new(jisoku::Jisoku::new())] | ||
| 23 | } | ||
