Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Node

Represents a Lavalink node

Hierarchy

Index

Constructors

constructor

Properties

address

address: string

The complete address of the node

apiVersion

apiVersion: number

The API version of the node

Optional autoReconnect

autoReconnect: boolean

Whether or not to automatically try reconnecting to the node

default

true

connected

connected: boolean

Whether or not the node is fully connected

host

host: string

The address of the node

password

password: string

The password of the node

port

port: string | number

The port of the node

Optional region

region: string

The geogrpahical region the node belongs to

This is used for regional node selection, this can be left out if this functionality is undesired

default

global

Optional resumeToken

resumeToken: string

The resumption token to use when reconnecting to the node

retries

retries: number

How may reconnection attempts were tried

shards

shards: number

The number of shards the connecting client has

stats

stats: undefined | StatsData

Statistics of the node

Will be undefined until the node has been ready for at least a minute

user

user: string

The ID of the connecting client

Static Readonly captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly 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): Node
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Node

connect

  • connect(): void

destroy

  • destroy(): void

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

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

    Returns boolean

eventNames

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

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

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

    • event: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

loadTracks

  • Instruct the node to load new tracks

    Parameters

    • search: string

      The search query, supports Lavalink specific modifiers such as ytsearch and scsearch

    Returns Promise<LoadTracksResponse>

    The response from the node

off

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

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

          • Rest ...args: any[]

          Returns void

    Returns Node

on

  • on(event: "ready", listener: () => void): Node
  • on(event: "error", listener: (e: Error) => void): Node
  • on(event: "message", listener: (msg: PlayerEvent | PlayerUpdate) => void): Node
  • on(event: "disconnected", listener: () => void): Node
  • on(event: "resumed", listener: () => void): Node

once

  • once(event: "ready", listener: () => void): Node
  • once(event: "error", listener: (e: Error) => void): Node
  • once(event: "message", listener: (msg: PlayerEvent | PlayerUpdate) => void): Node
  • once(event: "disconnected", listener: () => void): Node
  • once(event: "resumed", listener: () => void): Node

prependListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns Node

prependOnceListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns Node

rawListeners

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

    • event: string | symbol

    Returns Function[]

removeAllListeners

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

    • Optional event: string | symbol

    Returns Node

removeListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns Node

send

  • send(data: any): void

setMaxListeners

  • setMaxListeners(n: number): Node
  • Parameters

    • n: number

    Returns Node

Static getEventListener

  • getEventListener(emitter: DOMEventTarget | EventEmitter, name: string | symbol): Function[]
  • Returns a list listener for a specific emitter event name.

    Parameters

    • emitter: DOMEventTarget | EventEmitter
    • name: string | symbol

    Returns Function[]

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, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns AsyncIterableIterator<any>

Static once

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

    • emitter: NodeEventTarget
    • event: string | symbol
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

Generated using TypeDoc