#discord #rpc #ipc

discord-rpc-client

A Rust client for Discord RPC

12 releases

Uses old Rust 2015

0.3.0 Dec 6, 2018
0.2.4 Dec 4, 2018
0.2.3 Apr 8, 2018
0.1.5 Mar 28, 2018

#131 in HTTP client

Download history 76/week @ 2022-04-25 134/week @ 2022-05-02 58/week @ 2022-05-09 249/week @ 2022-05-16 108/week @ 2022-05-23 131/week @ 2022-05-30 97/week @ 2022-06-06 59/week @ 2022-06-13 76/week @ 2022-06-20 40/week @ 2022-06-27 61/week @ 2022-07-04 123/week @ 2022-07-11 61/week @ 2022-07-18 74/week @ 2022-07-25 74/week @ 2022-08-01 117/week @ 2022-08-08

331 downloads per month
Used in 4 crates

MIT license

29KB
829 lines

Build Status Build status crates.io crates.io Discord

Discord RPC Client

Discord RPC client for Rust

Installation

Add this to your Cargo.toml:

[dependencies]
discord-rpc-client = "^0.2"

Example

extern crate discord_rpc_client;

use std::{env, thread, time};
use discord_rpc_client::Client;

fn main() {
    // Get our main status message
    let state_message = env::args().nth(1).expect("Requires at least one argument");

    // Create the client
    let mut drpc = Client::new(425407036495495169);

    // Start up the client connection, so that we can actually send and receive stuff
    drpc.start();

    // Set the activity
    drpc.set_activity(|act| act.state(state_message))
        .expect("Failed to set activity");

    // Wait 10 seconds before exiting
    thread::sleep(time::Duration::from_secs(10));
}

More examples can be found in the examples directory.

Contributions

See CONTRIBUTING.md

Dependencies

~2.6–3.5MB
~67K SLoC