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_ipc::{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§
- DiscordIPC
Command Incoming - This defines a message coming from Discord into your app.
- DiscordIPC
Command Outgoing - This defines a message sent from your app to Discord.
- DiscordIPC
Error - The error response from Discord.
- Discord
IpcClient - A wrapper struct for the functionality contained in the
underlying
DiscordIpctrait. - Handshake
Data - The handshake data sent to Discord. for connection.
Enums§
- Activity
Cmd - This defines a message coming from Discord into your app.
- Activity
Event - All of the valid events for the IPC.
- DiscordIPC
Error Code - All of the possible errors from Discord.
- DiscordIPC
Error Code Critical - All of the possible errors from Discord (critical).
- DiscordIPC
Error Code NonCritical - All of the possible errors from Discord (non-critical).
- DiscordIPC
Payload - This defines all of the messages you can send to Discord from your app.
- DiscordIPC
Response - The response from Discord.
- Error
- The error type for this crate.
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().
Type Aliases§
- Result
- The result type for this crate.