| Crates.io | yet-another-discord-rpc |
| lib.rs | yet-another-discord-rpc |
| version | 0.1.0 |
| created_at | 2025-08-03 15:42:38.515676+00 |
| updated_at | 2025-08-03 15:42:38.515676+00 |
| description | Extremely simple, Discord Rich Presence client for Rust. |
| homepage | https://github.com/aspicho/yet-another-discord-rich-presence |
| repository | https://github.com/aspicho/yet-another-discord-rich-presence |
| max_upload_size | |
| id | 1779837 |
| size | 38,795 |
This an extremely simple Discord Rich Presence client, currently supporting only unix. Tested only on macOS as I don't have any windows or linux pc's available for testing and development.
It supporsts starting, updating, clearing and stopping activities. Activity is described via json using serde_json::json macro.
There's a multiple other crates that implements Discord RPC and I'm aware of them, however none of them fully satisfied my requirements, because I wanted and needed something that would fit this criteria:
I don't aim for it to be a replacement or competetor for any existing crate or project, the solo purpose of this project is to be a part of my other projects. However I'd be more than happy if it ended up being useful for anyone else, so feel free open issues and PR!
use yet_another_discord_rpc::DiscordRpc;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
const CLIENT_ID: &str = "your_discord_app_client_id";
let mut rpc = DiscordRpc::new(CLIENT_ID).await?;
rpc.start_activity(None).await?;
tokio::time::sleep(tokio::time::Duration::from_secs(6)).await;
rpc.set_activity(
json!({
"details": "Playing a game",
"state": "In main menu",
"assets": {
"large_image": "game_logo",
"large_text": "My Game"
}
})
).await?;
tokio::time::sleep(tokio::time::Duration::from_secs(10)).await;
rpc.stop_activity().await?;
Ok(())
}
To run the basic example:
cargo run -- <client_id>
To run with logging output:
RUST_LOG=info cargo run --features logging -- <client_id>
Optional logging support:
[dependencies]
yet-another-discord-rpc = { version = "0.1.0", features = ["logging"] }