async-circe/examples/basic-config/src/main.rs

26 lines
700 B
Rust

use async_circe::client::{Client, Config};
use async_circe::commands::parser::Command;
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), tokio::io::Error> {
let config = Config::new(
"karx.xyz",
6697,
"circe",
Some("async-circe"),
Some("+B"),
&["#main", "#no-normies"],
)
.await;
let (client, mut recv) = Client::new(config).await;
client.identify(&mut recv).await.unwrap();
loop {
if let Some(command) = recv.read().await? {
if let Command::PRIVMSG(nick, channel, message) = command {
println!("{} in {}: {}", nick, channel, message);
}
}
}
}