Skip to content
This repository was archived by the owner on Nov 4, 2025. It is now read-only.
/ ruvolt Public archive

An API wrapper for Revolt written in Rust

License

Notifications You must be signed in to change notification settings

arthurhoz/ruvolt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

164 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruvolt

ruvolt is an API library to interact with Revolt Chat APIs and create bots.

Getting started

Installation

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.

ruvolt = "*"
async-trait = "*"
tokio = { version = "*", features = ["macros", "rt-multi-thread"] }

Example - Ping/Pong bot

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, you can find here.

Examples

License

This project is under the MIT license.

About

An API wrapper for Revolt written in Rust

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages