twitch-irc-rs
This is a client library to interface with Twitch chat.
This library is async and runs using the tokio
runtime.
Example usage (This is the simple_listener
example, see examples/simple_listener.rs
and run it with cargo run --example simple_listener
):
use twitch_irc::login::StaticLoginCredentials;
use twitch_irc::TwitchIRCClient;
use twitch_irc::{ClientConfig, SecureTCPTransport};
#[tokio::main]
pub async fn main() {
let config = ClientConfig::default();
let (mut incoming_messages, client) =
TwitchIRCClient::<SecureTCPTransport, StaticLoginCredentials>::new(config);
let join_handle = tokio::spawn(async move {
while let Some(message) = incoming_messages.recv().await {
println!("Received message: {:?}", message);
}
});
client.join("sodapoppin".to_owned()).unwrap();
join_handle.await.unwrap();
}
Check out the documentation on docs.rs for more details.