pub struct Client {
pub cluster: Arc<Cluster>,
pub http: Arc<HttpClient>,
pub cache: Arc<InMemoryCache>,
pub framework: Option<Arc<Framework>>,
pub event_handler: Option<Arc<dyn EventHandler>>,
pub event_rx: Receiver<(u16, Event<'static>)>,
/* private fields */
}Expand description
The main Titanium Discord Client.
This struct is the central hub of your bot. It manages the connection to Discord, caches entities, and dispatches events to your handlers.
§Creating a Client
Use Client::builder to create a new client:
let client = Client::builder("your-token")
.intents(Intents::GUILD_MESSAGES)
.build()
.await?;§Thread Safety
Client is Clone and all internal state is wrapped in Arc, making it
safe to share across tasks.
Fields§
§cluster: Arc<Cluster>The gateway cluster managing WebSocket connections.
http: Arc<HttpClient>HTTP client for REST API requests.
cache: Arc<InMemoryCache>In-memory cache for guilds, channels, users, etc.
framework: Option<Arc<Framework>>Optional command framework.
event_handler: Option<Arc<dyn EventHandler>>Event handler for processing Discord events.
event_rx: Receiver<(u16, Event<'static>)>Channel receiving events from all shards.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more