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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rs.docs.ksoft.si/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
