6 releases

0.2.4 Jan 28, 2020
0.2.3 Jan 28, 2020
0.2.2 Apr 20, 2019
0.2.1 Feb 12, 2019
0.1.0 Feb 11, 2019

#9 in #discord-rich-presence

Apache-2.0

2MB
3K SLoC

C++ 1.5K SLoC // 0.0% comments C# 462 SLoC // 0.1% comments Rust 339 SLoC Python 249 SLoC C 172 SLoC // 0.0% comments Objective-C 61 SLoC // 0.1% comments INI 54 SLoC Unreal Plugin 28 SLoC Unreal Project 18 SLoC

rustcord

A safe wrapper around the Discord Rich Presence API, updated to the latest library version.
Wrapper version: 0.2.4
Discord RPC version: 3.4.0

Example

use rustcord::{Rustcord, EventHandlers, User, RichPresenceBuilder};
use std::io;

pub struct Handlers;

impl EventHandlers for Handlers {
    fn ready(user: User) {
        println!("User {}#{} logged in...", user.username, user.discriminator);
    }
}

fn main() -> Result<(), io::Error> {
    let discord = Rustcord::init::<Handlers>("APP_ID_HERE", true, None)?;

    let presence = RichPresenceBuilder::new()
        .state("Rusting")
        .details("Mining few crystals")
        .large_image_key("rust")
        .large_image_text("Rust")
        .small_image_key("amethyst")
        .small_image_text("Amethyst")
        .build();

    discord.update_presence(presence)?;
    loop {
        discord.run_callbacks();
    }

    Ok(())
}

Documentation

docs.rs

The C API Documentation

License

Apache-2.0

Dependencies