Very basic test for IRC library, include hyper for HTTP

This commit is contained in:
Darren VanBuren 2016-07-25 17:56:11 -07:00
parent f269514e8a
commit 5bbb554186
3 changed files with 20 additions and 0 deletions

2
.gitignore vendored
View file

@ -11,3 +11,5 @@
# Generated by Cargo # Generated by Cargo
/target/ /target/
# Config file
config.json

View file

@ -5,3 +5,4 @@ authors = ["Darren VanBuren <onekopaka@theoks.net>"]
[dependencies] [dependencies]
irc = "0.11.0" irc = "0.11.0"
hyper = "0.9"

View file

@ -1,3 +1,20 @@
extern crate irc;
use irc::client::prelude::*;
fn main() { fn main() {
println!("Hello, world!"); println!("Hello, world!");
let server = IrcServer::new("config.json").unwrap();
server.identify().unwrap();
for message in server.iter() {
let message = message.unwrap();
println!("Received message: {}", message);
match message.command {
Command::PRIVMSG(ref target, ref msg) => if msg.contains("rust-bot") {
server.send_privmsg(target, "Hello!").unwrap();
},
_ => (),
}
}
} }