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::{activity, DiscordIpc, DiscordIpcClient};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = DiscordIpcClient::new("<some client id>")?;
client.connect()?;
let payload = activity::Activity::new().state("Hello world!");
client.set_activity(payload)?;
}
Modules§
- activity
- Provides an interface for building activities to send
to Discord via
DiscordIpc::set_activity
.
Structs§
- Discord
IpcClient - A wrapper struct for the functionality contained in the
underlying
DiscordIpc
trait.
Traits§
- Discord
Ipc - A client that connects to and communicates with the Discord IPC.
Functions§
- new_
client Deprecated - Creates a new client to connect to the Discord IPC. Functionally
identical to
DiscordIpcClient::new()
.