Shard

Shard

Represents a Discord Shard

Constructor

new Shard()

Source:
Properties:
Name Type Description
id String

The id of the Shard

guilds Store

A store of guilds of each Shard

ms Number

The uptime of a shard in ms

latency Number

The API Latency of the Shard in ms

Methods

connect() → {Boolean}

Source:

Connects the shard

Returns:

Whether the connect was from a reconnect

Type
Boolean

disconnect(reconnectopt) → {Shard}

Source:

Disconnect/Reconnects a shard

Parameters:
Name Type Attributes Default Description
reconnect Boolean <optional>
false

Whether or not to reconnect

Returns:
Type
Shard

fetchAllMembers()

Source:

Sends an Opcode 8 ( Request Guild Members ) to discord

identify()

Source:

Sends the identify payload to discord for logging in

initiate() → {Shard}

Source:

Initiate the shard

Returns:
Type
Shard

listen_event(packet) → {Object.<Packet>}

Source:

Listens for Discord events from the Websocket

Parameters:
Name Type Description
packet Object

The packet received from discord

Returns:
Type
Object.<Packet>

listen_message(packet) → {Object.<Packet>}

Source:

Listens for messages from the Websocket

Parameters:
Name Type Description
packet Object

The packet received from discord

Returns:
Type
Object.<Packet>

resume()

Source:

Sends an Opcode 6 ( Resume ) to Discord

send(data) → {Data}

Source:

Sends data to the websocket

Parameters:
Name Type Description
data Any

The data to send

Returns:
Type
Data

setActivity(optionsopt) → {Object}

Source:

Sends an activity to the shard

Parameters:
Name Type Attributes Description
options Object <optional>

The options for the Activity

Properties
Name Type Attributes Default Description
since Number <optional>
null

Unix time (in milliseconds) of when the client went idle, or null if the client is not idle

game Object <optional>
null

The user's new activity

Properties
Name Type Attributes Default Description
name String <optional>
null

The activity's name

type Number <optional>
0

The activity's type

url String <optional>
null

The url of the activity ( Only for game type 1 )

status String <optional>
'online'

The new status of the client

afk Boolean <optional>
false

Whether or not the client is afk

Returns:

The options for the Activity

Type
Object

setup() → {Shard}

Source:

Setup some properties for the Shard

Returns:
Type
Shard