panda 0.5.3

An async Rust library for Discord
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut client = panda::new("your token here").await?;

    // Run this function every time a message is received
    client.on_message_create(|s, msg| async move {
        // Only respond if the message is !ping
        if msg.content == "!ping" {
            msg.send_message(&s.http, "!pong").await?;
        }

        Ok(())
    });

    client.start().await?;
    Ok(())
}