Skip to content

mthjones/slackbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slackbot

A higher level interface for creating Slack bots in Rust.

Crate Build Status

Usage

Add this to your Cargo.toml:

[dependencies]
slackbot = "*"

and this to your crate root:

extern crate slackbot;

Example

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();
}

License

slackbot is distributed under the MIT License.

About

Rust library to simplify making slack bots

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published