Module yobot::yobot [] [src]

Yobot is the main struct of the bot. Add a bunch of listeners and you call connect to connect the real time API and start listening for messages.

Example

fn main() {
    let token = match env::var("SLACK_BOT_TOKEN") {
        Ok(token) => token,
        Err(_) => panic!("Failed to get SLACK_BOT_TOKEN from env"),
    };
    let bot_name = match env::var("SLACK_BOT_NAME") {
        Ok(bot_name) => bot_name,
        Err(_) => panic!("Failed to get SLACK_BOT_NAME from env"),
    };

    let listener = EchoListener::new();
    let mut yobot = Yobot::new();
    yobot.add_listener(listener);
    yobot.connect(token, bot_name);
}

Structs

Yobot