diff --git a/.gitignore b/.gitignore index ea28ef0..c93d818 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ # Generated by Cargo /target/ +# Config file +config.json diff --git a/Cargo.toml b/Cargo.toml index 0bbf187..1305dbd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,3 +5,4 @@ authors = ["Darren VanBuren "] [dependencies] irc = "0.11.0" +hyper = "0.9" diff --git a/src/main.rs b/src/main.rs index e7a11a9..89df6d5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,20 @@ +extern crate irc; + +use irc::client::prelude::*; + fn main() { 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(); + }, + _ => (), + } + } }