dazeus 0.1.2

Dazeus IRC bot bindings for rust

Homepage: https://github.com/dazeus/dazeus-rs

Platform: Cargo

Language: Rust

License: MIT

View on registry: https://crates.io/crates/dazeus/


dazeus-rs

Rust bindings for DaZeus

Documentation

Documentation can be generated by running cargo doc in the project root. It can also be read online here.

Getting started

You will need an up to date Rust. At the time of writing this means you will need the latest nightlies.

To create a new plugin using these bindings simply run:

cargo new [plugin-name] --bin

Then in your Cargo.toml add:

[dependencies.dazeus]
git = "https://github.com/dazeus/dazeus-rs.git"

For parsing command line options I would also suggest you use something like docopt, to use it, add this to your Cargo.toml:

[dependencies]
docopt = "0.6"

Then start by using this basic skeleton application in your main.rs:

extern crate dazeus;
extern crate docopt;
use dazeus::{DaZeus, Commander, EventType, connection_from_str};
use docopt::Docopt;
// Write the Docopt usage string.
static USAGE: &'static str = "
A DaZeus plugin.

Usage:
 dazeus-plugin [options]

Options:
 -h, --help Show this help message
 -s SOCKET, --socket=SOCKET Specify the socket DaZeus is listening to, use
 `unix:/path/to/socket` or `tcp:host:port`
 [default: unix:/tmp/dazeus.sock]
";
fn main() {
 let args = Docopt::new(USAGE).and_then(|d| d.parse()).unwrap_or_else(|e| e.exit());
 let socket = args.get_str("--socket");
 match connection_from_str(socket) {
 Ok(connection) => {
 let dazeus = DaZeus::from_conn_buff(connection);
 // echo all messages
 dazeus.subscribe(EventType::PrivMsg, |evt| {
 // reply requires an event, and a message (the third event
 // parameter is the message sent to us)
 dazeus.reply(&evt, &evt[3], true);
 });
 // start listening for events
 dazeus.listen();
 },
 Err(e) => {
 println!("Got an error while trying to connect to DaZeus: {}", e);
 }
 }
}

Once you have set up your dependencies and created this main file you should be ready to go using cargo run, cargo should install all dependencies, compile your project and execute the result. If you don't have DaZeus running on your local machine, or if the default socket location is not what you're looking for, simply use cargo run -- --socket=[your socket].

веселые картинки развлекательные гифки интресные факты смешные видео смешные истории из соцсетей

Dependencies


GitHub Repository

dazeus/dazeus-rs dazeus/dazeus-rs

Rust bindings for DaZeus

Language: Rust

Created: March 16, 2015 21:08

Last updated: March 31, 2015 04:54

Last pushed: March 30, 2015 18:38

Size: 1.29 MB

Stars: 0

Forks: 0

Watchers: 3

Open issues: 0

Top Contributors

Ruben Nijveld

Releases

  • 0.1.2 - March 30, 2015 18:38

Related Projects

cairo-sys 0.0.2
Cairo bindings for Rust.
Cargo - Rust - MIT - Updated 3 months ago - 2 stars
ucontext 0.0.5
glibc's ucontext binding for rust
Cargo - Rust - MIT - Updated 2 months ago - 3 stars
udev 0.1.0
rust bindings to libudev
Cargo - Rust - LGPL-2.1 - Published 4 months ago - 5 stars
dazeus/dazeus-php
DaZeus PHP bindings
Packagist - PHP - MIT - Published 2 days ago
dazeus 0.7.1
Node.js Bindings for DaZeus
npm - JavaScript - MIT - Updated 6 months ago
веселые картинки развлекательные гифки интресные факты смешные видео смешные истории из соцсетей