36 lines
871 B
Rust
36 lines
871 B
Rust
use circe::{Client, Command, Config};
|
|
|
|
#[allow(unused_macros)]
|
|
macro_rules! loop_n {
|
|
($n:expr, $c:expr) => {{
|
|
for _ in 0..$n {
|
|
$c
|
|
}
|
|
}};
|
|
}
|
|
|
|
fn main() -> Result<(), std::io::Error> {
|
|
let config = Config::from_toml("config.toml")?;
|
|
/*let config = Config::new(
|
|
Box::new(["#main".to_string(), "#main2".to_string()]),
|
|
"192.168.178.100",
|
|
Some("+B".to_string()),
|
|
Some("IRSC".to_string()),
|
|
6667,
|
|
"IRSC",
|
|
);*/
|
|
let mut client = Client::new(config)?;
|
|
client.identify()?;
|
|
|
|
loop {
|
|
if let Ok(ref command) = client.read() {
|
|
if let Command::OTHER(line) = command {
|
|
print!("{}", line);
|
|
}
|
|
if let Command::PRIVMSG(channel, message) = command {
|
|
println!("PRIVMSG received: {} {}", channel, message);
|
|
}
|
|
}
|
|
}
|
|
}
|