| Crates.io | discordipc |
| lib.rs | discordipc |
| version | 0.1.1 |
| created_at | 2025-03-15 00:24:28.622964+00 |
| updated_at | 2025-03-15 13:54:40.22236+00 |
| description | A Rust crate that enables connection and interaction with Discord's IPC, allowing you to set custom activities for your project. |
| homepage | |
| repository | https://github.com/bllexz/discordipc |
| max_upload_size | |
| id | 1592888 |
| size | 89,622 |
discordipc is a Rust library that enables connection and interaction with Discord's IPC, allowing you to set custom activities for your project.
β
Rich Presence: Set custom activities, statuses, and more.
β
Event listeners: Handle Discord responses dynamically with event listeners.
β
Custom Packets: Extend functionality for advanced interactions.
Add the following to your Cargo.toml:
[dependencies]
discordipc = "0.1.1"
Or run:
cargo add discordipc
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(())
}
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.
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!