Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/augustt198/slackbot.rs
A bot for slack, made in rust
https://github.com/augustt198/slackbot.rs
Last synced: about 2 months ago
JSON representation
A bot for slack, made in rust
- Host: GitHub
- URL: https://github.com/augustt198/slackbot.rs
- Owner: augustt198
- Created: 2014-09-25T17:02:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-10-09T03:12:49.000Z (about 10 years ago)
- Last Synced: 2023-08-02T15:35:24.332Z (over 1 year ago)
- Language: Rust
- Homepage:
- Size: 196 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# slackbot.rs
A bot framework for [Slack](https://slack.com/), made in [Rust](http://www.rust-lang.org/).
## Usage
To make a bot using this framework, create a new cargo project and add the `slackbot.rs` dependency to `Cargo.toml`:
```toml
[dependencies.slackbot]
git = "https://github.com/augustt198/slackbot.rs"
```Inside the main function, create a new `SlackBot` struct using `Slackbot::new(port: int)`:
```rust
let mut slackbot = SlackBot::new(8080);
slackbot.username = Some(...); // Your bot's username (optional)
slackbot.icon_emoji = Some(...); // Your bot's icon emoji (optional)
slackbot.icon_url = Some(...); // Your bot's url emoji (optional)
```Any function with the `fn(&mut SlackCommand, &mut SlackResponse)` signature can be registered as a command:
```rust
fn test_command(cmd: &mut SlackCommand, resp: &mut SlackResponse) {
resp.reply("Hello, world!");
}slackbot.manager.register("test".to_string(), test_command);
```Finally, start the bot:
```rust
slackbot.start();
```---
Disclaimer: I have no idea what I'm doing, expect bad code.