diff options
author | jan <jan@ruken.pw> | 2016-04-06 17:54:12 (UTC) |
---|---|---|
committer | jan <jan@ruken.pw> | 2016-04-06 17:54:12 (UTC) |
commit | 314047dda73387fff1fd4ccdb35f5db6ea6d7d5a (patch) | |
tree | f6b0d4c52db0a93c9afa9989b4624f23193b3a28 /src/feature/mod.rs | |
parent | ac1f32f068a8c1e856b6db00a8058d9bf372a006 (diff) |
FEATURES!
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 | } | ||