use std::sync::Arc;
use twilight_gateway_queue::Queue;
use twilight_http::Client;
use twilight_model::gateway::{payload::update_status::UpdateStatusInfo, Intents};
#[derive(Clone, Debug)]
pub struct Config {
pub(crate) gateway_url: Option<String>,
pub(crate) http_client: Client,
pub(super) intents: Intents,
pub(super) large_threshold: u64,
pub(super) presence: Option<UpdateStatusInfo>,
pub(super) queue: Arc<Box<dyn Queue>>,
pub(crate) shard: [u64; 2],
pub(super) token: String,
pub(crate) session_id: Option<String>,
pub(crate) sequence: Option<u64>,
}
impl Config {
pub fn gateway_url(&self) -> Option<&str> {
self.gateway_url.as_deref()
}
pub fn http_client(&self) -> &Client {
&self.http_client
}
pub fn intents(&self) -> Intents {
self.intents
}
pub fn large_threshold(&self) -> u64 {
self.large_threshold
}
pub fn presence(&self) -> Option<&UpdateStatusInfo> {
self.presence.as_ref()
}
pub fn shard(&self) -> [u64; 2] {
self.shard
}
pub fn token(&self) -> &str {
&self.token
}
}
#[cfg(test)]
mod tests {
use super::Config;
use static_assertions::assert_impl_all;
use std::fmt::Debug;
assert_impl_all!(Config: Clone, Debug, Send, Sync);
}