Skip to main content

Module cache

Module cache 

Source
Expand description

In-memory cache populated automatically from gateway events. Attached to every Context as ctx.cache.

if let Some(guild) = ctx.cache.guild(msg.guild_id.as_deref().unwrap_or("")).await {
    println!("Guild name: {}", guild.name.unwrap_or_default());
}
println!("Bot is in {} guild(s)", ctx.cache.guild_count().await);

Structsยง

Cache
In-memory gateway cache.