KSoft.rs
KSoft.SI api wrapper written in pure Rust
FIRSTS STEPS
Add this to your Cargo.toml to add the crate to your project
[dependencies.ksoft]
version = "1.1.4"
In order to enable the `blocking` feature, you must disable default features
Added `serenity` feature implementing TypeMapKey for the client
Asynchronous example
use ksoft::Client;
#[tokio::main]
async fn main() {
let client = Client::new("TOKEN HERE"); //crate the client
if let Ok(meme) = client.images.random_meme().await { //try to get a random meme handling the possible error
//Do some logical stuff here...
} else {
//Handle possible response error
}
}
Blocking example
use ksoft::blocking::Client
fn main() {
let client = Client::new("TOKEN HERE"); //create the client
if let Ok(meme) = client.images.random_meme() { //try to get a random meme handling the possible error
//Do some logical stuff here...
} else {
//Error handling stuff
}
}
Last updated
Was this helpful?