aboutsummaryrefslogtreecommitdiff
path: root/src/feature/mod.rs
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2016-04-06 17:54:12 (UTC)
committerjan <jan@ruken.pw>2016-04-06 17:54:12 (UTC)
commit314047dda73387fff1fd4ccdb35f5db6ea6d7d5a (patch)
treef6b0d4c52db0a93c9afa9989b4624f23193b3a28 /src/feature/mod.rs
parentac1f32f068a8c1e856b6db00a8058d9bf372a006 (diff)
FEATURES!
Diffstat (limited to 'src/feature/mod.rs')
-rw-r--r--src/feature/mod.rs23
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 @@
1use std::boxed::Box;
2use std::error::Error;
3
4extern crate telegram_bot;
5use telegram_bot::{Api, Message};
6
7pub mod jisoku;
8pub mod tasterank;
9
10pub enum FeatureResult {
11 Handled,
12 Skip,
13}
14
15pub 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
21pub fn init() -> Vec<Box<Feature>> {
22 vec![Box::new(tasterank::Tasterank::new()), Box::new(jisoku::Jisoku::new())]
23}