Create a gateway manager.
The bot's token.
The rest manager to use for fetching gateway endpoints.
The cache to update from incoming events. If false
is specified, gateway events will not be passed to a cache event handler.
A callback to be used for logging events internally in the gateway manager.
Optional
logThisArg: anyA value to use as this
in the logCallback
.
The shard counts the manager is controlling.
Readonly
optionsOptions for the gateway manager. Note that any options not specified are set to a default value.
Gateway shards. Modifying this map externally may result in unexpected behavior.
Readonly
systemThe system string used for logging.
The latest self user received from the gateway.
Static
Readonly
API_The default gateway API version used.
Static
Readonly
REQUEST_The maximum length in bytes allowed for the nonce
property in a request guild members payload.
Static
Readonly
SHARD_The cooldown between spawning shards from the same bucket in milliseconds.
The average heartbeat ping in milliseconds across all shards.
The total guild count across all shards.
If all shards are in a guilds ready.
If all shards are in a ready state (or guilds ready).
Connect to the gateway.
Optional
gatewayBot: APIGatewayBotInfoA pre-fetched GET /gateway/bot
. Not required, as this method will fetch it if not specified.
The results from shard spawns; [success, failed]
.
Get the average ping across all shards.
Get members from a guild.
The ID of the guild to get members from.
Guild member request options. By default, all members in the guild will be fetched.
Received members, presences, and missing members.
Get a guild's shard.
The guild's ID.
Optional
ensure: TIf true, an error is thrown if a GatewayShard is not found.
The guild's shard, or a shard ID if the shard is not in this manager.
Update the bot's presence.
Presence data.
A shard or shards to set the presence on. A number will set the presence on a single shard with a matching ID, a number array will set the presence on all shards matching am ID in the array, and all
will set the presence on all shards.
Update the bot's voice state.
The guild to set the voice state in.
The channel to join. null
disconnects the bot.
If the bot should self mute.
If the bot should self deafen.
The gateway manager. Manages shards, handles incoming payloads, and sends commands to the Discord gateway.
All events are emitted with their entire payload; Discord API Reference. Dispatched events are emitted under the
*
event prior to being passed through the cache event handler. After being handled by the cache manager, they are emitted again under their individual event name (example:GUILD_CREATE
).