rxrefluxer

Rust API wrapper for Fluxer

Build Fluxer bots and integrations in typed async Rust.

refluxer gives you a typed REST client, WebSocket gateway, event handlers, shared bot context, Fluxer models, permissions, IDs, and snowflake support without pulling in more runtime than you need.

If refluxer looks useful, a GitHub star helps other Fluxer developers find it. Star the project

let client = Client::builder()
    .token(&token)
    .event_handler(Handler)
    .build()?;

client.start().await
RESTtyped requests
Gatewayheartbeat + reconnect
Clientevent handlers

Install

Start with the layer you need.

Use the default HTTP client for API work, or enable the high-level client for gateway events and bot handlers.

Cargo
cargoaddrefluxer--featuresclient
Cargo.toml
[dependencies]
refluxer = { version = "0.2", features = ["client"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
async-trait = "0.1"

What it ships

A small stack for real bots, not just endpoint wrappers.

01

Typed HTTP API

Call Fluxer REST endpoints through Rust models and structured errors instead of untyped JSON plumbing.

02

Gateway sessions

Receive WebSocket events through typed dispatch, heartbeat handling, session resume, and client-level reconnect backoff.

03

Bot client layer

Register event handlers, receive a shared context, and send replies from the same async flow.

04

Fluxer-native types

Use models, permissions, IDs, and snowflakes that mirror the platform instead of scattering primitives everywhere.

Quick start

A ping bot in one file.

The high-level client lets the gateway event become normal Rust control flow.

ping_bot.rs
requires feature: client
use refluxer::model::message::Message;
use refluxer::{Client, Context, EventHandler};

struct Handler;

#[async_trait::async_trait]
impl EventHandler for Handler {
    async fn message_create(&self, ctx: Context, msg: Message) {
        if msg.author.bot.unwrap_or(false) {
            return;
        }

        if msg.content == "!ping" {
            ctx.send_message(msg.channel_id, "Pong!").await.ok();
        }
    }
}

#[tokio::main]
async fn main() -> Result<(), refluxer::Error> {
    let token = std::env::var("FLUXER_TOKEN")
        .expect("FLUXER_TOKEN env var required");

    let client = Client::builder()
        .token(&token)
        .event_handler(Handler)
        .build()?;

    client.start().await
}

Feature flags

Keep dependency sets explicit.

FeatureUse it forDefault
httpREST client and shared modelsyes
gatewayWebSocket gateway support, includes httpno
clientHigh-level bot framework, includes gatewayno

Examples

From API calls to production-shaped bot patterns.

HTTP only

cargo run -p refluxer --example http_only

Ping, reminders, translation

cargo run -p refluxer --example ping_bot --features client

Standalone heavy examples

cargo run --manifest-path examples/gitbot/Cargo.toml