Crates.io | panda |
lib.rs | panda |
version | 0.5.3 |
source | src |
created_at | 2020-03-13 18:53:25.287254 |
updated_at | 2020-06-13 19:31:07.22133 |
description | An async Rust library for Discord |
homepage | |
repository | https://github.com/xyaman/panda |
max_upload_size | |
id | 218312 |
size | 196,236 |
A powerful async Rust library for interacting with Discord's API
Even thought this library is usable, it still under development, so don't use for production yet.
Note that this library doesn't support the 100% of discord API yet, for example voice. See
TODO list
to more information.
cargo add panda
or in Cargo.toml
panda = "0.5.3"
panda supports tokio
and async-std
runtimes, by default it uses tokio
,
to use async-std
change the feature flags in Cargo.toml
[dependencies.panda]
version = "0.5.3"
default-features = false
features = ["async-std-runtime"]
It will print the bot name when the bot is ready.
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut client = panda::new("your token here").await?;
client.on_ready(|s, ready| async move {
println!("Bot {} is ready", ready.user.username);
Ok(())
});
client.start().await?;
Ok(())
}
All events are in the Discord Documentation, and to use it in client, you have to use client.on_
plus
the event in snake case.