discord.js - Imagine ❄d-I❄
discord.js - Imagine ❄2y ago
13 replies
Cam

Cache of GuildMembers

Hi, how long does it take for the bot to delete members from cache? For get some full members of some roles i put this code in 'ready' events. When bot starts, guild.members.size returned 100% memberCount but some time latter (about half day), it returns only 20-30% of memberCount. Is there any way to keep the cache always full. I just only want to get full members of some roles at anytime more and than that the presence of the member

        const guild = await client.guilds.fetch({ guild: client.config.guildId, force: true, cache: true })
        await guild.members.fetch({ cache: true, force: true, withPresences: true })


Client Options:
const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.DirectMessages,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildPresences,
        GatewayIntentBits.GuildMessageReactions,
        GatewayIntentBits.GuildVoiceStates,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildEmojisAndStickers
    ], partials: [
        Partials.Message,
        Partials.Reaction,
        Partials.Channel,
        Partials.ThreadMember
    ],
})
Was this page helpful?