Very basic test for IRC library, include hyper for HTTP
This commit is contained in:
parent
f269514e8a
commit
5bbb554186
3 changed files with 20 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -11,3 +11,5 @@
|
||||||
# Generated by Cargo
|
# Generated by Cargo
|
||||||
/target/
|
/target/
|
||||||
|
|
||||||
|
# Config file
|
||||||
|
config.json
|
||||||
|
|
|
@ -5,3 +5,4 @@ authors = ["Darren VanBuren <onekopaka@theoks.net>"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
irc = "0.11.0"
|
irc = "0.11.0"
|
||||||
|
hyper = "0.9"
|
||||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -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();
|
||||||
|
},
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue