Updated examples after Command redesign.

This commit is contained in:
Aaron Weiss 2016-01-30 05:00:16 -05:00
parent 2eb0e63d59
commit b6ce088693
4 changed files with 17 additions and 42 deletions

View file

@ -17,12 +17,11 @@ fn main() {
for message in server.iter() {
let message = message.unwrap(); // We'll just panic if there's an error.
print!("{}", message.into_string());
if &message.command[..] == "PRIVMSG" {
if let Some(msg) = message.suffix {
if msg.contains("pickles") {
server.send_privmsg(&message.args[0], "Hi!").unwrap();
}
}
match message.command {
Command::PRIVMSG(ref target, ref msg) => if msg.contains("pickles") {
server.send_privmsg(target, "Hi!").unwrap();
},
_ => (),
}
}
}