feat(stats): query http gateway, wait until gateway up to collect discord stats

This commit is contained in:
alyssa 2024-09-27 18:53:04 +09:00
parent e4ed354536
commit 9ff824c37b
7 changed files with 130 additions and 17 deletions

View file

@ -1,6 +1,7 @@
use anyhow::format_err;
use lazy_static::lazy_static;
use std::sync::Arc;
use tokio::sync::RwLock;
use twilight_cache_inmemory::{
model::CachedMember,
permission::{MemberRoles, RootError},
@ -110,10 +111,14 @@ pub fn new() -> DiscordCache {
.build(),
);
DiscordCache(cache, client)
DiscordCache(cache, client, RwLock::new(Vec::new()))
}
pub struct DiscordCache(pub Arc<InMemoryCache>, pub Arc<twilight_http::Client>);
pub struct DiscordCache(
pub Arc<InMemoryCache>,
pub Arc<twilight_http::Client>,
pub RwLock<Vec<u32>>,
);
impl DiscordCache {
pub async fn guild_permissions(