use std::sync::Arc;
use super::DiscordState;
impl DiscordState {
pub async fn set_connected(&self, http: Arc<serenity::http::Http>, channel_id: Option<u64>) {
*self.http.lock().await = Some(http);
if let Some(id) = channel_id {
*self.owner_channel_id.lock().await = Some(id);
}
}
pub async fn set_owner_channel(&self, channel_id: u64) {
*self.owner_channel_id.lock().await = Some(channel_id);
}
pub async fn http(&self) -> Option<Arc<serenity::http::Http>> {
self.http.lock().await.clone()
}
pub async fn owner_channel_id(&self) -> Option<u64> {
*self.owner_channel_id.lock().await
}
pub async fn set_bot_user_id(&self, id: u64) {
*self.bot_user_id.lock().await = Some(id);
}
pub async fn bot_user_id(&self) -> Option<u64> {
*self.bot_user_id.lock().await
}
pub async fn set_guild_id(&self, id: u64) {
*self.guild_id.lock().await = Some(id);
}
pub async fn guild_id(&self) -> Option<u64> {
*self.guild_id.lock().await
}
pub async fn is_connected(&self) -> bool {
self.http.lock().await.is_some()
}
}