Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Shard

Hierarchy

  • EventEmitter
    • Shard

Implements

Index

Constructors

constructor

  • Parameters

    Returns Shard

Properties

client

client: Client

connectAttempts

connectAttempts: number

connectTimeout

connectTimeout: null | Timeout

connecting

connecting: boolean

Optional discordServerTrace

discordServerTrace: undefined | string[]

getAllUsersCount

getAllUsersCount: {}

Type declaration

  • [guildID: string]: boolean

getAllUsersLength

getAllUsersLength: number

getAllUsersQueue

getAllUsersQueue: string

globalBucket

globalBucket: Bucket

guildCreateTimeout

guildCreateTimeout: null | Timeout

guildSyncQueue

guildSyncQueue: string[]

guildSyncQueueLength

guildSyncQueueLength: number

heartbeatInterval

heartbeatInterval: null | Timeout

id

id: number

lastHeartbeatAck

lastHeartbeatAck: boolean

lastHeartbeatReceived

lastHeartbeatReceived: null | number

lastHeartbeatSent

lastHeartbeatSent: null | number

latency

latency: number

on

preReady

preReady: boolean

presence

presence: Presence

presenceUpdateBucket

presenceUpdateBucket: Bucket

ready

ready: boolean

reconnectInterval

reconnectInterval: number

requestMembersPromise

requestMembersPromise: {}

Type declaration

seq

seq: number

sessionID

sessionID: null | string

status

status: "ready" | "disconnected" | "connecting" | "handshaking" | "resuming"

unsyncedGuilds

unsyncedGuilds: number

ws

ws: any

Readonly Static captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Readonly Static errorMonitor

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): Shard
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Shard

checkReady

  • checkReady(): void
  • Returns void

connect

  • connect(): void
  • Returns void

createGuild

  • Parameters

    Returns Guild

disconnect

  • disconnect(options?: { reconnect?: undefined | boolean | "auto" }, error?: Error): void
  • Parameters

    • Optional options: { reconnect?: undefined | boolean | "auto" }
      • Optional reconnect?: undefined | boolean | "auto"
    • Optional error: Error

    Returns void

editAFK

  • editAFK(afk: boolean): void
  • Parameters

    • afk: boolean

    Returns void

editStatus

emit

  • emit(event: string, ...args: any[]): void
  • Parameters

    • event: string
    • Rest ...args: any[]

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getGuildMembers

  • getGuildMembers(guildID: string, timeout: number): void
  • Parameters

    • guildID: string
    • timeout: number

    Returns void

getMaxListeners

  • getMaxListeners(): number
  • Returns number

hardReset

  • hardReset(): void
  • Returns void

heartbeat

  • heartbeat(normal?: boolean): void
  • Parameters

    • Optional normal: boolean

    Returns void

identify

  • identify(): void
  • Returns void

initializeWS

  • initializeWS(): void
  • Returns void

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): Shard
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Shard

onPacket

  • Parameters

    Returns void

once

  • once(event: string | symbol, listener: (...args: any[]) => void): Shard
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Shard

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): Shard
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Shard

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): Shard
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Shard

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): Shard
  • Parameters

    • Optional event: string | symbol

    Returns Shard

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): Shard
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Shard

requestGuildMembers

requestGuildSync

  • requestGuildSync(guildID: string): void
  • Parameters

    • guildID: string

    Returns void

reset

  • reset(): void
  • Returns void

restartGuildCreateTimeout

  • restartGuildCreateTimeout(): void
  • Returns void

resume

  • resume(): void
  • Returns void

sendStatusUpdate

  • sendStatusUpdate(): void
  • Returns void

sendWS

  • sendWS(op: number, _data: Record<string, unknown>, priority?: boolean): void
  • Parameters

    • op: number
    • _data: Record<string, unknown>
    • Optional priority: boolean

    Returns void

setMaxListeners

  • setMaxListeners(n: number): Shard
  • Parameters

    • n: number

    Returns Shard

syncGuild

  • syncGuild(guildID: string): void
  • Parameters

    • guildID: string

    Returns void

toJSON

  • Parameters

    • Optional props: string[]

    Returns JSONCache

wsEvent

  • Parameters

    Returns void

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string): Promise<any[]>
  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>

Generated using TypeDoc