.assertReady()
→ void
Assertion that client is ready (throws if not).
client.assertReady();Class
Main Fluxer bot client. Connects to the gateway, emits events, and provides REST access.
Extends EventEmitter
new Client(options: ClientOptions)ClientOptions| Name | Type | Description |
|---|---|---|
| cacheread-only | CacheController | Cache limits, stats, sweeps, and cascade entry points. |
| channelsread-only | ChannelManager | Channel cache and manager. |
| eventsread-only | ClientEventMethods | Typed event handlers. Prefer client.events.* or client.on(Events.*, ...). |
| guildsread-only | GuildManager | Guild cache and manager. |
| instanceread-only | ResolvedInstance | Resolved instance endpoints (API, CDN, invite, …) for this client. Isolated per client — safe for multi-instance processes. |
| loggerread-only | Logger | Structured logger (zero-dep). |
| optionsread-only | ClientOptions | Resolved client options (cache defaults applied). |
| packsread-only | PackManager | Emoji/sticker pack REST wrappers (/packs/*). |
| readyAt | Date | null | Timestamp when the client became ready. Null until READY is received. |
| restread-only | REST | REST client for making API requests. |
| Routesstaticread-only | typeof Routes | |
| user | ClientUser | null | The authenticated bot user. Null until READY is received. |
| usersread-only | UserManager | User cache and manager. |
| wsread-only | WebSocketManager | The underlying WebSocketManager (throws if not logged in). |
→ void
Assertion that client is ready (throws if not).
client.assertReady();requests: BulkFetchMessagesRequest[], options?: BulkFetchMessagesOptions & { hydrate?: true } → Promise<BulkFetchMessagesResult>
requests: BulkFetchMessagesRequest[], options: BulkFetchMessagesOptions & { hydrate: false } → Promise<APIBulkMessageFetchResponse>
client.bulkFetchMessages(requests);username: string, discriminator: string → Promise<APIUserTagCheck>
Check username#discriminator availability.
stringUsername to checkstringDiscriminator to checkclient.checkUsernameTag(username, discriminator);→ Promise<void>
Disconnect from gateway, clear all caches, and reset state. Safe to call login again after destroy.
await client.destroy();event: K, args: ClientEvents[K] → boolean
event: string | symbol, args: unknown[] → boolean
Emit an event with typed arguments.
client.emit(event, args);→ Promise<APIApplicationMe>
Fetch the current application (/applications/@me).
client.fetchApplication();emojiId: string → Promise<APIEmojiMetadata>
Fetch emoji metadata by ID.
stringEmoji snowflakeclient.fetchEmojiMetadata(emojiId);→ Promise<APIGatewayBotResponse>
Fetch gateway connection info (/gateway).
client.fetchGatewayInfo();→ Promise<APIInstance>
Fetch instance discovery document (/.well-known/fluxer).
client.fetchInstance();→ Promise<APIOAuthApplication[]>
Fetch OAuth2 applications owned by this bot.
client.fetchOAuthApplications();stickerId: string → Promise<APIStickerMetadata>
Fetch sticker metadata by ID.
stringSticker snowflakeclient.fetchStickerMetadata(stickerId);origin: DiscoveryOrigin, options: Omit<ClientOptions, 'instance'>, connectOptions?: { signal?: AbortSignal; } → Promise<Client>
Create a client from instance discovery (GET /.well-known/fluxer). Does not log in — call login with a token afterward.
DiscoveryOriginAPI origin used only to fetch discovery (e.g. https://api.example.com)Omit<ClientOptions, 'instance'>Client options (must not conflict with discovered endpoints.api){ signal?: AbortSignal; }Optional abort signal for the discovery requestawait Client.fromDiscovery(origin, options);→ boolean
Type guard for ready state (narrows client.user to non-null).
client.isReady();token: string, options?: { signal?: AbortSignal; } → Promise<string>
Connect to the gateway with a bot token.
stringBot token from the developer portal{ signal?: AbortSignal; }Optional abort signal for cancellationawait client.login(token);event: K, listener: ClientEventListener<K> → this
event: string | symbol, listener: (...args: unknown[]) => void → this
Remove an event listener for a specific event type.
client.off(event, listener);event: K, listener: ClientEventListener<K> → this
event: string | symbol, listener: (...args: unknown[]) => void → this
Register an event listener for a specific event type.
client.on(event, listener);event: K, listener: ClientEventListener<K> → this
event: string | symbol, listener: (...args: unknown[]) => void → this
Register a one-time event listener for a specific event type.
client.once(event, listener);channelIds: string[] → Promise<APIPreloadMessagesResponse>
Preload recent messages for multiple channels (batch endpoint).
string[]Array of channel IDs to preloadclient.preloadMessages(channelIds);channelIds: string[] → Promise<APIPreloadMessagesResponse>
Preload recent messages (alternate endpoint).
string[]Array of channel IDs to preloadclient.preloadMessagesAlt(channelIds);options: { guildId?: string; guildIds?: string[]; query?: string; limit?: number; userIds?: string[]; presences?: boolean; nonce?: string; } → void
Request guild members via gateway opcode 8 (GUILD_MEMBERS_CHUNK responses). Provide guildId and/or guildIds.
client.requestGuildMembers(options);emoji: string | { name: string; id?: string; animated?: boolean }, guildId?: string | null → Promise<string>
Resolve emoji input to API format (e.g., name:id or Unicode).
string | { name: string; id?: string; animated?: boolean }Emoji string or object with name/id/animatedstring | nullGuild ID for custom emoji lookup (optional)await client.resolveEmoji(emoji);shardId: number, payload: GatewaySendPayload → void
Send a gateway payload to a specific shard.
numberShard ID (0-indexed)GatewaySendPayloadGateway send payload (opcode + data)client.sendToGateway(shardId, payload);filter?: (member: GuildMember, guildId: string) => boolean → number
Sweep cached members across all guilds (remove entries matching filter). Prefer CacheController.sweepMembers (client.cache.sweepMembers).
(member: GuildMember, guildId: string) => booleanPredicate to test each member (return true to remove)client.sweepMembers();filter?: (message: APIMessage, channelId: string) => boolean, channelId?: string → number
Sweep cached messages (remove entries matching filter). Prefer CacheController.sweepMessages (client.cache.sweepMessages).
(message: APIMessage, channelId: string) => booleanPredicate to test each message (return true to remove)stringOptional channel ID to scope sweepclient.sweepMessages();