Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Arthur-Damasceno/ruvolt
An API wrapper for Revolt written in Rust
https://github.com/Arthur-Damasceno/ruvolt
api-library api-wrapper revolt
Last synced: 3 months ago
JSON representation
An API wrapper for Revolt written in Rust
- Host: GitHub
- URL: https://github.com/Arthur-Damasceno/ruvolt
- Owner: Arthur-Damasceno
- License: mit
- Created: 2022-01-24T12:27:12.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-25T01:06:46.000Z (over 2 years ago)
- Last Synced: 2024-10-11T20:19:46.593Z (4 months ago)
- Topics: api-library, api-wrapper, revolt
- Language: Rust
- Homepage:
- Size: 205 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-revolt - Ruvolt - Revolt API wrapper for create bots. (💻 API Libraries / Rust)
README
# Ruvolt
`ruvolt` is an API library to interact with [Revolt Chat](https://revolt.chat) APIs and create bots.## Getting started
### Installation
To use `ruvolt` we need [ruvolt](https://github.com/Arthur-Damasceno/ruvolt), [async-trait](https://github.com/dtolnay/async-trait) and an asynchronous runtime, let's use the [tokio](https://github.com/tokio-rs/tokio).
Add this to your `Cargo.toml` *dependencies* section and run `cargo build` to compile dependencies.```toml
ruvolt = "*"
async-trait = "*"
tokio = { version = "*", features = ["macros", "rt-multi-thread"] }
```### Example - Ping/Pong bot
```rust
use {
async_trait::async_trait,
ruvolt::{models::Message, Client, Context, EventHandler, Result},
std::env,
};struct Handler;
#[async_trait]
impl EventHandler for Handler {
async fn message(&self, cx: Context, msg: Message) {
let content = msg.content.to_string();if content == "!ping" {
msg.reply(&cx, "Pong!", true).await.ok();
}
}
}#[tokio::main]
async fn main() -> Result {
let token = env::var("TOKEN").unwrap();
let mut client = Client::new(Handler, token).await?;client.listen().await
}
```### Documentation
#### Rust docs
A documentation generated by [rustdoc](https://doc.rust-lang.org/rustdoc/what-is-rustdoc.html), you can find [here](https://docs.rs/ruvolt).#### Examples
- [A more complex Ping/Pong bot](examples/ping_pong.rs)
- [A counter bot](examples/counter.rs)## License
This project is under the [MIT](LICENSE) license.