Cleaned up code and added documentation.

This commit is contained in:
Aaron Weiss 2017-06-21 17:15:30 -04:00
parent 073b82feec
commit 3369ef5ff2
No known key found for this signature in database
GPG key ID: 0237035D9BF03AE2
9 changed files with 166 additions and 106 deletions

View file

@ -14,16 +14,20 @@ fn main() {
};
let server = IrcServer::from_config(config).unwrap();
server.identify().unwrap();
server.stream().for_each(|message| {
print!("{}", message);
match message.command {
Command::PRIVMSG(ref target, ref msg) => {
if msg.contains("pickles") {
server.send_privmsg(target, "Hi!").unwrap();
server
.stream()
.for_each(|message| {
print!("{}", message);
match message.command {
Command::PRIVMSG(ref target, ref msg) => {
if msg.contains("pickles") {
server.send_privmsg(target, "Hi!").unwrap();
}
}
_ => (),
}
_ => (),
}
Ok(())
}).wait().unwrap()
Ok(())
})
.wait()
.unwrap()
}