filthy-rich 0.10.0

Tiny, ergonomic Discord Rich Presence library for your Rust apps.
Documentation

filthy-rich

Tiny, ergonomic Discord Rich Presence library for your Rust apps.

Crates.io Total Downloads Crates.io MSRV Crates.io Size Crates.io License

// A sneak-peek into what you will be working with:
//
use anyhow::Result;
use filthy_rich::{PresenceRunner, types::Activity};

#[tokio::main]
async fn main() -> Result<()> {
    let mut runner = PresenceRunner::new("1463450870480900160");

    let activity = Activity::new()
        .name("cool app name")
        .details("Something?")
        .state("Probably~")
        .build();

    let client = runner.run(true).await?;
    client.set_activity(activity).await?;

    runner.wait().await?;

    Ok(())
}

Bulletin

[!WARNING] Even though this library follows most of Discord's spec-sheet, some features which are not even implemented in Discord itself but were included in the documentation have been skipped for a smoother experience.

[!WARNING] Expect breaking changes before the v1.0.0 release.

[!NOTE] Requires Rust 1.82.0 or later (MSRV).

Getting Started

Add filthy-rich to your project with this command:

cargo add filthy-rich

🌺 Features

  • Really easy to implement; just create a client ID at the Discord Developer Portal and you're good to go.
  • Fruitful Activity builder guaranteed to make you fall in love with setting presences.
  • Ergonomic on_ready, on_activity_send etc. events to aid you with states when building apps.
  • Clean whilst being easy; properly handles Discord's responses.
  • Fully asynchronous but easily wrappable for synchronous usage.
  • Client-runner architecture for easy-adding in state-driven GUI apps or games.
  • Auto-reconnect on failure.

Starter Snippets

Examples are included with the project. See these:

  1. For an indefinitely running rich presence, see this.
  2. For an timed, changing rich presence, see this.
  3. For a very simple snippet, see this.

To run these:

# First, clone and `cd` into the repository.
git clone https://github.com/hitblast/filthy-rich && cd filthy-rich

# Now, run any of the examples:
cargo run --example indefinite  # ex. 1
cargo run --example timed  # ex. 2
cargo run --example simple  # ex. 3

API Reference (docs.rs)

https://docs.rs/filthy-rich/latest/filthy_rich/

Yet another library?

I don't want to bother myself with manually implementing Rich Presence everytime I start working on an app, so I created this library to make things much simpler; I just want a client that does its job in the background.

Also, other implementations felt much more complex to me and also felt like they lacked precise control. This is a more "spread-out" opinion and might hide the truth for some libraries, but yeah, nothing better than throwing your own luck into making yet another IPC RPC client.

Contributors

Thanks to the amazing contributors for adding to this repository:

Changelog

For a comprehensive release changelog of this library, please refer to CHANGELOG.md.

License

Licensed under MIT.