# KSoft.rs

## FIRSTS STEPS

Add this to your Cargo.toml to add the crate to your project

```
[dependencies.ksoft]
version = "1.1.4"
```

{% hint style="info" %}
&#x20;Since the crate is fully asynchronous, you might want to also add tokio to your project, but if you have a non-asynchronous context, you can enable the \`blocking\` feature to support blocking operations.
{% endhint %}

{% hint style="danger" %}
In order to enable the \`blocking\` feature, you must disable default features
{% endhint %}

{% hint style="success" %}
Added \`serenity\` feature implementing TypeMapKey for the client
{% endhint %}

## Asynchronous example

```rust
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

```rust
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
    }
}
```
