Skip to content

🚀 This new wiki is in beta! Please double-check for any issue and report them on the GitHub

Cache Policy & Flags

When defining a bot, you can control how DiSky caches members and other Discord entities. Proper cache configuration optimizes memory usage and performance.

The cache policy determines which members are cached and accessible without retrieval.

PolicyDescriptionRequired Intent
allCache all members in all guildsGuild Members (privileged)
noneDon’t cache any membersNone
ownerCache only guild ownersNone
onlineCache only online membersGuild Presences (privileged)
voiceCache only members in voice channelsGuild Voice States
boosterCache only server boostersGuild Members (privileged)
defaultDefault policy (recommended)Guild Members + Guild Presences

Members in cache can be accessed instantly using getters:

# If member is cached, this works instantly
set {_member} to member with id "123" in {_guild}

Members not in cache must be retrieved (requires API call):

# If member is not cached, you must retrieve it
retrieve member with id "123" from {_guild} and store it in {_member}
# Use {_member} here

Use all if:

  • You need access to all members
  • Your bot manages members
  • You have the Guild Members intent

Use online if:

  • You only work with online members
  • You want to save memory
  • You have the Guild Presences intent

Use none if:

  • You don’t work with members
  • You only use slash commands
  • You want minimal memory usage

Use default if:

  • You’re unsure what you need
  • You want balanced performance

Cache flags determine what data is cached about entities.

FlagDescriptionRequired Intent
activityMember activities (playing, streaming, etc.)Guild Presences (privileged)
voice stateMember voice channel statesGuild Voice States
emojiGuild emojisGuild Emojis and Stickers
stickerGuild stickersGuild Emojis and Stickers
client statusMember device status (mobile, desktop, web)Guild Presences (privileged)
member overridesMember permission overridesNone
role tagsRole tags (bot role, booster role, etc.)None
forum tagsForum tags and thread tagsNone
online statusMember online statusGuild Presences (privileged)
scheduled eventsGuild scheduled eventsScheduled Events
OptionDescription
allEnable all cache flags
noneDisable all cache flags
default flagsEnable activity, voice state, and online status

Use default flags for most bots:

cache flags: default flags

This enables:

  • Activity (what members are playing)
  • Voice state (voice channel presence)
  • Online status (online, idle, dnd, offline)

Use specific flags if you have special needs:

# Only cache what you need
cache flags: emoji, sticker, forum tags

Use all if you need everything:

cache flags: all

Use none for minimal memory:

cache flags: none
define new bot named "MyBot":
token: "YOUR_TOKEN"
intents: guild messages
policy: none
cache flags: none

Use when:

  • Only using slash commands
  • No member management
  • Minimal memory footprint needed
define new bot named "MyBot":
token: "YOUR_TOKEN"
intents: default intents, guild members, message content
policy: all
cache flags: default flags

Use when:

  • Working with members
  • Need member status
  • General-purpose bot
define new bot named "MyBot":
token: "YOUR_TOKEN"
intents: default intents, guild voice states
policy: voice
cache flags: voice state

Use when:

  • Music/voice bot
  • Only need members in voice
  • Want to optimize memory
define new bot named "MyBot":
token: "YOUR_TOKEN"
intents: default intents, guild expressions
policy: none
cache flags: emoji, sticker

Use when:

  • Managing emojis/stickers
  • Don’t need member data
define new bot named "MyBot":
token: "YOUR_TOKEN"
intents: all intents
policy: all
cache flags: all

Use when:

  • Need all features
  • Memory is not a concern
  • Want maximum functionality

More caching = more memory usage:

none < owner < booster < voice < online < all

Less caching = more API calls needed:

  • Cached data: Instant access, no API call
  • Uncached data: Must retrieve, requires API call + time

For most bots, this is optimal:

policy: all
cache flags: default flags

It provides:

  • Instant member access
  • Status/activity information
  • Voice state tracking
  • Reasonable memory usage

Your member might not be cached.

Solutions:

  1. Use a wider cache policy (e.g., all)
  2. Enable Guild Members intent
  3. Retrieve the member instead of getting it:
    retrieve member with id "123" from {_guild} and store it in {_member}

You’re caching too much.

Solutions:

  1. Use a narrower policy (online, voice, or none)
  2. Reduce cache flags to only what you need
  3. Don’t use all for policy and cache flags unless necessary

You need cache flags enabled.

Solution:

cache flags: activity, online status

And enable Guild Presences intent.

  1. Start with defaults - They work for most bots
  2. Enable required intents - Cache flags won’t work without proper intents
  3. Monitor memory - Adjust cache settings if memory is an issue
  4. Cache what you use - Don’t cache data you never access
  5. Consider bot size - Large bots (100+ servers) should be more conservative with caching