[−][src]Crate panda
Async Discord Library
Panda it's a very simple and friendly discord api library
Features
- Fast
- Simple
Configuring async runtime
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.1"
default-features = false
features = ["async-std-runtime"]
Example usage
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.
Re-exports
pub use models::gateway::events; |
Modules
| client | Panda Client |
| models | Discord Models |
| utils |
Structs
| HttpClient | It's the http client of panda, it have methods to make requests to all routes |
Enums
| PandaError | The error enum for Panda |
Functions
| new | Create a new panda Client without state |
| new_with_state | Create a new panda Client with state |
Type Definitions
| HandlerResult | Alias for Result<(), Box |
| Session | Alias for Arc<SessionData |