TopStats Rust SDK
Rust SDK for the TopStats.gg API - Discord bot statistics from Top.gg.
Installation
[]
= "0.1.0"
For blocking mode:
[]
= { = "0.1.0", = false, = ["blocking", "ureq-client"] }
Usage
use ;
async
Links
License
MIT
Rust SDK for the TopStats.gg API - Discord bot statistics from Top.gg.
[dependencies]
topstats = "0.1.0"
For blocking mode:
[dependencies]
topstats = { version = "0.1.0", default-features = false, features = ["blocking", "ureq-client"] }
use topstats::{Client, RankingsQuery, SortBy};
#[tokio::main]
async fn main() -> Result<(), topstats::Error> {
let client = Client::new("your-api-token")?;
// Get bot information
let bot = client.get_bot("432610292342587392").await?;
println!("{} has {} monthly votes", bot.name, bot.monthly_votes);
// Get rankings
let rankings = client
.get_rankings(RankingsQuery::default().sort_by(SortBy::MonthlyVotes).limit(10))
.await?;
for bot in &rankings.data {
println!("#{}: {}", bot.monthly_votes_rank, bot.name);
}
Ok(())
}
MIT