ruvolt
is an API library to interact with Revolt Chat APIs and create bots.
To use ruvolt
we need ruvolt, async-trait and an asynchronous runtime, let's use the 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"] }
```rust use { asynctrait::asynctrait, ruvolt::{models::Message, Client, Context, EventHandler, Result}, std::env, };
struct Handler;
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();
}
}
}
async fn main() -> Result { let token = env::var("TOKEN").unwrap(); let mut client = Client::new(Handler, token).await?;
client.listen().await
} ```
A documentation generated by rustdoc, you can find here.
This project is under the MIT license.