Go to file
Michael Pfaff d99145133d
Add partial Java bindings
2022-02-03 16:56:26 -05:00
.git-hooks/pre_push Add Discord rich presence support 2018-03-22 15:35:48 +01:00
examples Add partial Java bindings 2022-02-03 16:56:26 -05:00
java Add partial Java bindings 2022-02-03 16:56:26 -05:00
src Add partial Java bindings 2022-02-03 16:56:26 -05:00
.editorconfig Add Discord rich presence support 2018-03-22 15:35:48 +01:00
.gitignore Add partial Java bindings 2022-02-03 16:56:26 -05:00
.gitlab-ci.yml Update GitLab CI configuration 2018-12-04 22:16:47 +01:00
.overcommit.yml Add Discord rich presence support 2018-03-22 15:35:48 +01:00
CHANGELOG.md Update changelog 2018-12-06 02:21:22 +01:00
CONTRIBUTING.md Fix typo in CONTRIBUTING.md 2018-04-09 16:51:08 +02:00
Cargo.toml Add partial Java bindings 2022-02-03 16:56:26 -05:00
LICENSE Add LICENSE 2018-03-22 17:43:30 +00:00
README.md Update readme 2018-12-06 01:27:39 +01:00
appveyor.yml Build examples in CI 2018-04-09 19:34:31 +02:00

README.md

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