Crate discord_rich_presence[][src]

Expand description

This library provides easy access to the Discord IPC.

It provides implementations for both Unix and Windows operating systems, with both implementations using the same API. Thus, this crate can be used in a platform-agnostic manner.

Hello world

use discord_rich_presence::{new_client, DiscordIpc};
use serde_json::json;
 
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = new_client("<some client id>")?;
    client.connect()?;
 
    let payload = json!({
        "state": "Hello world!"
    });
    client.set_activity(payload)?;
}

Traits

DiscordIpc

A client that connects to and communicates with the Discord IPC.

Functions

new_client

Creates a new client to connect to the Discord IPC.