Verified Commit a1d573b5 authored by Mathias B.'s avatar Mathias B.
Browse files

Déplacement de la fonction de comptage lorsque que le bot fait le chargement initial des serveurs

parent 029a3572
......@@ -66,7 +66,6 @@ impl EventHandler for Handler {
async fn guild_create(&self, ctx: Context, guild: Guild, is_new: bool) {
info!("Guild {} received",;
tokio::spawn(synchrotron::event_handler::guild_create(ctx.clone(), guild.clone(), is_new));
functions::update_guilds_count(&ctx, ctx.cache.guilds().await.len()).await;
async fn guild_delete(&self, ctx: Context, incomplete: GuildUnavailable, _full: Option<Guild>) {
......@@ -4,6 +4,7 @@ use serenity::client::bridge::gateway::ChunkGuildFilter;
use crate::repositories::GuildRepository;
use crate::repositories::ConfigRepository;
use datastructs::discord::GuildData;
use crate::utils::functions;
pub async fn cache_ready(ctx: Context, guilds: Vec<GuildId>){
for guild_id in &guilds { // Lancer la synchronisation en fond
......@@ -22,5 +23,6 @@ pub async fn guild_create(ctx: Context, guild: Guild, is_new: bool){
if is_new { // Indirectement lancer la tâche de synchronisation en fond
ctx.shard.chunk_guild(, None, ChunkGuildFilter::None, None);
functions::update_guilds_count(&ctx, ctx.cache.guilds().await.len()).await;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment