2 releases
0.1.1 | Oct 4, 2024 |
---|---|
0.1.0 | Oct 4, 2024 |
#1152 in Web programming
47 downloads per month
24KB
175 lines
cleverbotfreeapi
cleverbotfreeapi
is a Rust client library for interacting with a washed down version of the Cleverbot API for free.
This crate provides easy-to-use interfaces for sending messages to Cleverbot and receiving responses. Suitable for async builds like web servers or bots.
Features
- Get cleverbot responses.
- Maintain conversation history.
- Retry failed requests automatically (configurable).
Usage
Here is a basic example of using cleverbotfreeapi
to send a message to Cleverbot and receive a response:
use cleverbotfreeapi::{CleverbotBuilder, Error};
#[tokio::main]
async fn main() -> Result<(), Error> {
let cleverbot = CleverbotBuilder::default().build().await?;
let response = cleverbot.get_response("are you a bot").await?;
println!("response: {}", response); // would respond with something like "no, I'm human"
Ok(())
}
For more detailed examples, see the examples directory in the repository.
Contributing
Contributions are welcome!
Potential future features
- Sessions, to automatically manage different conversations happening in different "places". Not sure if this is a good idea, as some people might be happy with im-memory sessions, some might want to use a db, etc.
- Tests
Links
Dependencies
~6–17MB
~218K SLoC