| Crates.io | titanium-gateway |
| lib.rs | titanium-gateway |
| version | 0.1.6 |
| created_at | 2025-12-11 14:49:50.60393+00 |
| updated_at | 2025-12-12 20:32:28.132337+00 |
| description | High-performance Discord Gateway WebSocket client |
| homepage | |
| repository | https://github.com/Sh4dowNotFound/titanium-rs |
| max_upload_size | |
| id | 1979851 |
| size | 211,772 |
Titanium-rs is a high-performance, concurrent Discord library for Rust, designed for massive scale.
Full documentation is available on docs.rs. To build locally:
cargo doc --open
simd-json when enabled).mimalloc support for high throughput.DashMap.Add this to your Cargo.toml:
use titanium_rs::prelude::*;
use std::env;
#[tokio::main]
async fn main() {
let token = env::var("DISCORD_TOKEN").expect("Expected DISCORD_TOKEN");
let intents = Intents::GUILD_MESSAGES | Intents::MESSAGE_CONTENT;
let client = Client::builder(token)
.intents(intents)
.event_handler(Handler)
.build()
.await
.expect("Err creating client");
if let Err(why) = client.start().await {
println!("Client error: {:?}", why);
}
}
struct Handler;
#[async_trait]
impl EventHandler for Handler {
async fn message_create(&self, ctx: Context, msg: Message<'_>) {
if msg.content == "!ping" {
let response = titanium_model::builder::MessageBuilder::new()
.content("Pong!")
.build();
let _ = ctx.http.create_message(msg.channel_id, &response).await;
}
}
}
Check out the examples/ directory for full working bots:
To run an example:
cargo run --example basic_bot
To enable high-performance memory allocation:
[dependencies]
titanium-rs = { version = "0.1", features = ["performance"] }
This project adheres to strict safety standards:
#![deny(unsafe_code)] is enforced globally.AGPL-3.0-or-later