Wait for All Guilds
Delay Ready until every guild from the handshake is in cache.
By default Ready fires when the gateway READY payload arrives. READY lists the bot's guilds as unavailable stubs ({ id, unavailable: true }) that land in client.guilds with available === false. Full snapshots arrive shortly after as GUILD_CREATE and emit GuildAvailable (not GuildCreate). If your Ready handler needs every guild fully loaded, turn on waitForGuilds.
If a gateway still sends READY.guilds: [], Fluxer opens a short hydration window (GUILD_STREAM_SETTLE_MS) and treats those later snapshots as GuildAvailable even when waitForGuilds is off. Ready still fires immediately in that case; turn on waitForGuilds if you need the cache complete first.
While guilds are syncing, other gateway events (like MESSAGE_CREATE) are held and replayed after Ready. That keeps setup work in Ready from racing with early message handlers.
Enable it
import { Client, Events } from '@fluxerjs/core';
const client = new Client({
waitForGuilds: true,
});
client.on(Events.Ready, () => {
// Every guild from READY should be present and fully loaded
console.log(`Bot is in ${client.guilds.size} guilds`);
for (const [id, guild] of client.guilds) {
console.log(`- ${guild.name} (${guild.channels.size} channels)`);
}
});
await client.login(process.env.FLUXER_BOT_TOKEN);GuildCreate vs GuildAvailable
GuildCreate is for guilds the bot joins after Ready. Startup / reconnect backfill uses GuildAvailable. If an older bot still seeds state from GuildCreate on every restart, set emitGuildCreateOnStartup: true (not recommended for new code). See Upgrading to 3.1.
When you need it
Use this when Ready iterates all guilds: syncing a database, seeding caches, or posting a startup announcement everywhere.
If you only care about a handful of guild IDs, skip it and call client.guilds.resolve(guildId) (or fetch) for those IDs instead.