5 releases

0.2.2 Oct 11, 2020
0.2.1 Aug 28, 2020
0.2.0 Jan 17, 2020
0.1.1 Jun 12, 2019
0.1.0 Jun 11, 2019

#36 in HTTP client

34 downloads per month
Used in modbot

MIT/Apache

20KB
487 lines

dbl-rs

crates.io docs.rs Rust version License build status

Rust bindings for the top.gg / discordbots.org API.

Usage

Add this to your Cargo.toml

[dependencies]
dbl-rs = "0.2"

Example

use dbl::types::ShardStats;
use dbl::Client;
use tokio::runtime::Runtime;

#[tokio::main]
async fn main() {
    let token = match std::env::var("DBL_TOKEN") {
        Ok(token) => token,
        _ => panic!("missing token"),
    };

    let client = Client::new(token).expect("failed client");

    let bot = 565_030_624_499_466_240;
    let stats = ShardStats::Cumulative {
        server_count: 1234,
        shard_count: None,
    };

    match client.update_stats(bot, stats).await {
        Ok(_) => println!("Update successful"),
        Err(e) => eprintln!("{}", e),
    }
}

Examples

See examples directory for some getting started examples.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~4–9MB
~214K SLoC