2 releases
0.1.1 | Mar 15, 2025 |
---|---|
0.1.0 | Mar 15, 2025 |
#1458 in Network programming
232 downloads per month
51KB
653 lines
π‘ Discord IPC
discordipc
is a Rust library that enables connection and interaction with Discord's IPC, allowing you to set custom activities for your project.
β Features
β
Rich Presence: Set custom activities, statuses, and more.
β
Event listeners: Handle Discord responses dynamically with event listeners.
β
Custom Packets: Extend functionality for advanced interactions.
π Installation
Add the following to your Cargo.toml
:
[dependencies]
discordipc = "0.1.1"
Or run:
cargo add discordipc
π§ Basic usage
use discordipc::{activity::Activity, packet::Packet, Client};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new_simple("<application_id>");
client.connect_and_wait()?.filter()?;
let activity = Activity::new().details("Some activity");
let activity_packet = Packet::new_activity(Some(&activity), None);
match client.send_and_wait(activity_packet)?.filter() {
Ok(_packet) => println!("Activity has been set!"),
Err(e) => println!("Couldn't set activity: {}", e),
}
println!("Press ENTER to exit...");
std::io::stdin().read_line(&mut String::new()).unwrap();
client.disconnect()?;
println!("Disconnected");
Ok(())
}
π Examples
All usage examples are located in the examples folder. You can run an example by executing:
cargo run --example <example_name>
Replace <example_name>
with the name of the example file you wish to try.
π€ Contributing
This is a small project and all contributions are widely appreciated! Any help whether it's improving the documentation, fixing bugs, adding new features, or sharing ideas is welcome.
Donβt forget to leave a β if you find the library useful!
Dependencies
~1.5β2.5MB
~52K SLoC