Crates.io | rustcord |
lib.rs | rustcord |
version | 0.2.4 |
source | src |
created_at | 2019-02-11 20:40:20.521976 |
updated_at | 2020-01-28 16:58:55.656433 |
description | A safe wrapper around the Discord Rich Presence API |
homepage | |
repository | https://github.com/AregevDev/rustcord |
max_upload_size | |
id | 114167 |
size | 30,789 |
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
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(())
}
Apache-2.0