Skip to content

Latest commit

 

History

History
23 lines (22 loc) · 700 Bytes

README.md

File metadata and controls

23 lines (22 loc) · 700 Bytes

rust-hackchat-bot

Rust Powered Hack-Chat bot.

Demo:

fn main() {
    let mut hack_chat = HackChat::new("rust_bot".to_string(), "programming".to_string());
    hack_chat.on_message.push(Box::new(|chat, msg, nick| {
        println!("[{}]: {}", nick, msg);
    }));
    hack_chat.on_whisper.push(Box::new(|chat, msg, from, _| {
        println!("Whisper from [{}]: {}", from, msg);
    }));
    hack_chat.on_join.push(Box::new(|chat, nick| {
        println!("[{}] joined the chat", nick);
    }));
    hack_chat.on_leave.push(Box::new(|chat, nick| {
        println!("[{}] left the chat", nick);
    }));
    hack_chat.daemon();
    hack_chat.send_message("Hello, everyone!");
    loop {}
}