Skip to main content

fluxer/
lib.rs

1//! # fluxer-rs
2//!
3//! Rust API wrapper for [Fluxer](https://fluxer.app). Handles the gateway
4//! connection, heartbeating, reconnection, and event dispatch.
5//!
6//! # Quick Start
7//!
8//! ```rust,no_run
9//! use fluxer::prelude::*;
10//!
11//! struct MyHandler;
12//!
13//! #[async_trait]
14//! impl EventHandler for MyHandler {
15//!     async fn on_ready(&self, _ctx: Context, ready: Ready) {
16//!         println!("Logged in as {}", ready.user.username);
17//!     }
18//!
19//!     async fn on_message(&self, ctx: Context, msg: Message) {
20//!         if msg.content.as_deref() == Some("!ping") {
21//!             let channel_id = msg.channel_id.as_deref().unwrap_or_default();
22//!             let _ = ctx.http.send_message(channel_id, "Pong!").await;
23//!         }
24//!     }
25//! }
26//!
27//! #[tokio::main]
28//! async fn main() {
29//!     let mut client = Client::builder("your-bot-token")
30//!         .event_handler(MyHandler)
31//!         .build();
32//!
33//!     client.start().await.expect("Client error");
34//! }
35//! ```
36
37pub mod cache;
38pub mod client;
39pub mod event;
40pub mod error;
41pub mod http;
42pub mod model;
43pub mod voice;
44
45/// Re-exports the stuff you'll need most of the time so you can just `use fluxer::prelude::*;` and get going.
46pub mod prelude {
47    pub use crate::cache::Cache;
48    pub use crate::client::{Client, ClientBuilder, Context};
49    pub use crate::error::ClientError;
50    pub use crate::event::EventHandler;
51    pub use crate::model::*;
52    pub use crate::voice::FluxerVoiceConnection;
53    pub use async_trait::async_trait;
54}