Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Player

Represents a connection between Lavalink and Discord

A player is the primary way to interact with Lavalink

Hierarchy

  • EventEmitter
    • Player

Index

Constructors

constructor

Properties

connected

connected: boolean

Whether or not the player is connected and considered ready for use

id

id: string

The ID of the guild that this player is serving

node

node: Node

The node supporting this player

paused

paused: boolean

Whether or not the player is currently paused

state

state: undefined | PlayerUpdateState

The current state of the player

Will be undefined until some time after the player starts playing a track

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): Player
  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns Player

connect

destroy

  • destroy(): void

disconnect

  • disconnect(): void

emit

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

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

    Returns boolean

eq

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[]

off

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

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

          • Rest ...args: any[]

          Returns void

    Returns Player

on

once

play

  • play(track: string, options?: TrackPlay): void

prependListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns Player

prependOnceListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns Player

rawListeners

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

    • event: string | symbol

    Returns Function[]

removeAllListeners

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

    • Optional event: string | symbol

    Returns Player

removeListener

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

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

          • Rest ...args: any[]

          Returns void

    Returns Player

seek

  • seek(position: number): void
  • Seek the currently playing track

    Parameters

    • position: number

      Where the track should be seeked to

    Returns void

setMaxListeners

  • setMaxListeners(n: number): Player
  • Parameters

    • n: number

    Returns Player

stop

  • stop(): void

switchChannel

  • switchChannel(channelID: string): void
  • Move the player to a different voice channel

    Parameters

    • channelID: string

      The channel the player should be moved to

    Returns void

togglePlayback

  • togglePlayback(): boolean

updateVoiceState

  • updateVoiceState(channelID?: string, mute?: boolean, deaf?: boolean): void
  • Change the client's voice state

    Parameters

    • Optional channelID: string

      Channel to switch to, omit to disconnect

    • mute: boolean = false

      Should the client appear mute?

    • deaf: boolean = false

      Should the client appear deaf?

    Returns void

volume

  • volume(volume: number): void
  • Change the volume of the player

    Parameters

    • volume: number

      The volume the player should be set to

    Returns void

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