aboutsummaryrefslogtreecommitdiff
path: root/src/feature/mod.rs
blob: b57c1791599ab13b2596208512d157459c94e4e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::boxed::Box;

extern crate telegram_bot;
use telegram_bot::{Api, Message};
extern crate rustc_serialize;

pub mod jisoku;
pub mod tasterank;
pub mod topanime;

pub enum FeatureResult {
    Handled,
    Skip,
}

pub trait Feature {
    fn name(&self) -> &'static str;
    fn init(&mut self);
    fn handle(&mut self, Api, Message) -> Result<FeatureResult, String>;
}

pub fn init() -> Vec<Box<Feature>> {
    vec![Box::new(tasterank::Tasterank::new()),
         Box::new(jisoku::Jisoku::new()),
         Box::new(topanime::TopAnime::new())]
}