A higher level interface for creating Slack bots in Rust.
Add this to your Cargo.toml
:
[dependencies]
slackbot = "*"
and this to your crate root:
extern crate slackbot;
Here's a simple example to show how to make a bot that just echoes back what was said to it:
extern crate slackbot;
use slackbot::{SlackBot, Sender};
fn main() {
let mut echo_bot = SlackBot::new("bot", "BOT_API_TOKEN");
echo_bot.on("echo", Box::new(|sender: &mut Sender, args: &Vec<String>| {
if args.len() > 0 {
sender.respond_in_channel(args.join(" ")).unwrap();
} else {
sender.respond_in_channel("echo echo echo").unwrap();
}
}));
echo_bot.run().unwrap();
}
slackbot
is distributed under the MIT License.