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.x
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.
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]
.
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.
[Discord API Reference]
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.
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.
Generated using TypeDoc
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
).