Crate slackbot [−] [src]
slackbot is here to make creating your own Slack bot easy. It provides a relatively high-level interface for creating Slack bots.
Examples
Creates a bot that will respond to a message like !bot echo Hello world!
with Hello world!
for any channels it is in.
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(); }
Structs
Sender |
The sender of a command to the bot. |
SlackBot |
The bot that handles commands and communication with Slack. |
Traits
CommandHandler |
A trait implemented by types that can handle commands. |