Added a simple response to the simple example.
This commit is contained in:
parent
f0e3db4ce6
commit
5ac62acfd9
1 changed files with 9 additions and 1 deletions
|
@ -1,10 +1,11 @@
|
|||
#![feature(if_let)]
|
||||
#![feature(slicing_syntax)]
|
||||
extern crate irc;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use irc::data::config::Config;
|
||||
use irc::server::{IrcServer, Server};
|
||||
use irc::server::utils::identify;
|
||||
use irc::server::utils::{identify, send_privmsg};
|
||||
|
||||
fn main() {
|
||||
let config = Config {
|
||||
|
@ -22,5 +23,12 @@ fn main() {
|
|||
identify(&server).unwrap();
|
||||
for message in server.iter() {
|
||||
print!("{}", message.into_string());
|
||||
if message.command[] == "PRIVMSG" {
|
||||
if let Some(msg) = message.suffix {
|
||||
if msg.contains("pickles") {
|
||||
send_privmsg(&server, message.args[0][], "Hi!").unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue