aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorTill Hoeppner2014-11-21 11:31:55 +0100
committerTill Hoeppner2014-11-21 11:31:55 +0100
commit6ed12a0993d56330bb008adc86bfb5ebe4320583 (patch)
treec572f69b19c82ee298004948f7a13a2dbebd0076 /src/main.rs
parentd738bcd85bc9d7ea47d8995a57a594ead6bb0f73 (diff)
downloadirsc-6ed12a0993d56330bb008adc86bfb5ebe4320583.tar.gz
irsc-6ed12a0993d56330bb008adc86bfb5ebe4320583.tar.xz
irsc-6ed12a0993d56330bb008adc86bfb5ebe4320583.zip
Upload to crates.io plus fixes for changes in Rust
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/main.rs b/src/main.rs
deleted file mode 100644
index 865234a..0000000
--- a/src/main.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-#![feature(globs, slicing_syntax)]
-
-extern crate irsc;
-
-use irsc::server::Server;
-use irsc::color::bold;
-use irsc::event;
-use irsc::event::{ Event, ParseResult, PrivMsg };
-
-static NAME: &'static str = "rusticbot";
-static DESC: &'static str = "A bot, written in Rust.";
-
-fn callback(arg: (Server, Event)) {
- let (mut server, event) = arg;
- match event.command[] {
- event::PRIVMSG => {
- let privmsg: PrivMsg = ParseResult::parse(event).unwrap();
- let response = format!("You wrote: {}", bold(privmsg.content[]));
- server.msg(privmsg.from.nickname[], response[]).unwrap();
- },
- _ => ()
- }
-}
-
-fn main() {
- let mut s = Server::new();
- s.connect("irc.freenode.org".into_string(), 6667).unwrap();
- s.nick(NAME).unwrap();
- s.user(NAME, "*", "*", DESC).unwrap();
- s.join("#botzoo").unwrap();
-
- s.msg("flan3002", "Hey!").unwrap();
-
- s.events.lock().register(&callback);
-
- // Dedicate this thread to listening and event processing
- s.listen().unwrap();
-}