Shard

Shard

Represents a shard

Constructor

new Shard()

Properties:
Name Type Attributes Description
id Number

The ID of the shard

connecting Boolean

Whether the shard is connecting

discordServerTrace Array.<String> <nullable>

Debug trace of Discord servers

lastHeartbeatReceived Number

Last time Discord acknowledged a heartbeat, null if shard has not sent heartbeat yet

lastHeartbeatSent Number

Last time shard sent a heartbeat, null if shard has not sent heartbeat yet

latency Number

The current latency between the shard and Discord, in milliseconds

ready Boolean

Whether the shard is ready

status String

The status of the shard. "disconnected"/"connecting"/"handshaking"/"ready"/"identifying"/"resuming"

Source:

Extends

  • EventEmitter

Methods

connect()

Tells the shard to connect

Source:

disconnect(optionsopt, nullable, erroropt)

Disconnects the shard

Source:
Parameters:
Name Type Attributes Description
options Object <optional>
<nullable>

Shard disconnect options

Name Type Attributes Description
reconnect String | Boolean <optional>

false means destroy everything, true means you want to reconnect in the future, "auto" will autoreconnect

error Error <optional>

The error that causes the disconnect

editAFK(afk)

Update the bot's AFK status.

Source:
Parameters:
Name Type Description
afk Boolean

Whether the bot user is AFK or not

editStatus(statusopt, activitiesopt)

Updates the bot's status on all guilds the shard is in

Source:
Parameters:
Name Type Attributes Description
status String <optional>

Sets the bot's status, either "online", "idle", "dnd", or "invisible"

activities Array | Object <optional>

Sets the bot's activities. A single activity object is also accepted for backwards compatibility

Name Type Attributes Description
name String <optional>

The name of the activity. Note: When setting a custom status, use state instead

type Number

The type of the activity. 0 is playing, 1 is streaming (Twitch only), 2 is listening, 3 is watching, 4 is custom status, 5 is competing in

url String <optional>

The URL of the activity

state String <optional>

The state of the activity. This is the text to be displayed as the bots custom status

Events

disconnect

Fired when the shard disconnects

Properties:
Name Type Attributes Description
err Error <nullable>

The error, if any

Source:

ready

Fired when the shard turns ready

Source:

resume

Fired when a shard finishes resuming

Source: