https://github.com/aircastdev/trovo-rs
A https://trovo.live api & chat client written in and for rust
https://github.com/aircastdev/trovo-rs
Last synced: 6 months ago
JSON representation
A https://trovo.live api & chat client written in and for rust
- Host: GitHub
- URL: https://github.com/aircastdev/trovo-rs
- Owner: AircastDev
- License: apache-2.0
- Created: 2021-07-05T09:48:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-10T19:58:29.000Z (over 2 years ago)
- Last Synced: 2024-03-15T15:07:46.359Z (about 1 year ago)
- Language: Rust
- Homepage: https://crates.io/crates/trovo
- Size: 64.5 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README

[](https://crates.io/crates/trovo)
[](https://docs.rs/trovo)
[](https://github.com/AircastDev/trovo-rs/actions?query=workflow%3A%22main%22)# trovo-rs
A Rust api & chat client for [Trovo](https://trovo.live).
It currently doesn't support all of the trovo api, feel free to open a PR adding new endpoints.
### Example
Find a user by username and then connect to their chat.
```rust
use futures::prelude::*;
use std::{env, error::Error};
use trovo::ClientId;#[tokio::main]
async fn main() -> Result<(), Box> {
let client_id = env::var("CLIENT_ID").expect("missing CLIENT_ID env var");
let username = env::var("USER_NAME").expect("missing USER_NAME env var");let client = trovo::Client::new(ClientId::new(client_id));
println!("looking up user '{}'", username);
let user = client
.user(username)
.await?
.expect("no user found for the given username");
println!("found user {:#?}", user);let mut messages = client.chat_messages_for_channel(&user.channel_id).await?;
println!("listening for chat messages");
while let Some(msg) = messages.next().await {
let msg = msg?;
println!("[{}] {}", msg.nick_name, msg.content);
}Ok(())
}
```## License
Licensed under either of
- Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)at your option.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.