Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robotty/twitch-irc-rs
Twitch IRC library for the Rust programming language
https://github.com/robotty/twitch-irc-rs
chatbot crate irc rust-programming-language twitch twitch-bot twitch-irc-library twitchtv
Last synced: 26 days ago
JSON representation
Twitch IRC library for the Rust programming language
- Host: GitHub
- URL: https://github.com/robotty/twitch-irc-rs
- Owner: robotty
- License: mit
- Created: 2020-01-25T12:45:22.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-28T10:05:34.000Z (6 months ago)
- Last Synced: 2024-10-06T14:46:46.050Z (2 months ago)
- Topics: chatbot, crate, irc, rust-programming-language, twitch, twitch-bot, twitch-irc-library, twitchtv
- Language: Rust
- Homepage: https://crates.io/crates/twitch-irc
- Size: 547 KB
- Stars: 105
- Watchers: 5
- Forks: 25
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-twitch-dev - robotty/twitch-irc-rs - Twitch IRC library for the Rust programming language. (Libraries / Rust)
README
# twitch-irc-rs
[![Rust CI status](https://github.com/robotty/twitch-irc-rs/workflows/Rust/badge.svg)](https://github.com/robotty/twitch-irc-rs/actions)
[![Crates.io](https://img.shields.io/crates/v/twitch-irc)](https://crates.io/crates/twitch-irc)
[![Docs.rs](https://docs.rs/twitch-irc/badge.svg)](https://docs.rs/twitch-irc)This is a client library to interface with [Twitch](https://www.twitch.tv/) 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`):
```rust
use twitch_irc::login::StaticLoginCredentials;
use twitch_irc::TwitchIRCClient;
use twitch_irc::{ClientConfig, SecureTCPTransport};#[tokio::main]
pub async fn main() {
// default configuration is to join chat as anonymous.
let config = ClientConfig::default();
let (mut incoming_messages, client) =
TwitchIRCClient::::new(config);// first thing you should do: start consuming incoming messages,
// otherwise they will back up.
let join_handle = tokio::spawn(async move {
while let Some(message) = incoming_messages.recv().await {
println!("Received message: {:?}", message);
}
});// join a channel
// This function only returns an error if the passed channel login name is malformed,
// so in this simple case where the channel name is hardcoded we can ignore the potential
// error with `unwrap`.
client.join("sodapoppin".to_owned()).unwrap();// keep the tokio executor alive.
// If you return instead of waiting the background task will exit.
join_handle.await.unwrap();
}
```Check out the [documentation on docs.rs](https://docs.rs/twitch-irc) for more details.