36 lines
840 B
Rust
36 lines
840 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(
|
|
vec!["#main", "#main2"],
|
|
"192.168.178.100",
|
|
Some("+B"),
|
|
Some("IRSC"),
|
|
6667,
|
|
"circe",
|
|
);
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|