Rust Discord Activity
A lightweight Rust library to control Discord Rich Presence
Installation
Rust Discord Activity is available directly on crates.io:
cargo add rust-discord-activity
How to use
Three steps:
- Create your Activity and set desired data using provided structs
- Create a new Payload with your Activity
- Instantiate a new DiscordClient and send your Payload through it
Et voilà !
Example
let limg = Some;
let simg = Some;
let asset = new;
let now_in_millis = now.duration_since.unwrap.as_millis;
let timestamp = new;
let party = new;
let mut button_vec = vec!;
button_vec.push;
button_vec.push;
let mut activity = new;
activity
.set_state
.set_activity_type
.set_details
.set_timestamps
.set_assets
.set_party
.set_instance
.set_buttons;
let payload = new;
let mut client = new;
let _ = client.send_payload;
And voilà! This sets-up a new Activity for the current Discord user:
Next Steps
- Write proper documentation for this library
- Write unit tests