Discord Player

Player

No description provided

Player extends PlayerEventsEmitter<PlayerEvents>

new Player(client, options);
ParameterTypeOptionalDescription
clientClient<boolean>The Discord Client
optionsPlayerInitOptionsThe player init options

Properties

public client: any

The discord.js client

public events: any

The player events channel

public extractors: any

The extractors manager

public id: any

The unique identifier of this player instance

public lyrics: any

The lyrics api

public nodes: any

The player nodes (queue) manager

public options: any

The player options

public requiredEvents: any

public version: any

The player version

public voiceUtils: any

The voice api utilities

public static defaultMaxListeners: any

public static version: any

The version of discord-player

public context: any

The hooks context for this player instance.

public eventLoopLag: any

Event loop latency in ms. If your bot is laggy and this returns a number above 20ms for example, some expensive task is being executed on the current thread which is slowing down the event loop.

public hasDebugger: any

public queryCache: any

The current query cache provider in use

public queues: any

Alias to Player.nodes.

Methods

public [iterator](): Generator<GuildQueue<unknown>void | unknown>

public addListener(name, listener): Player

ParameterTypeOptional
nameK
listenerPlayerEvents[K]

public createPlaylist(data): Playlist

Creates Playlist instance

ParameterTypeOptionalDescription
dataPlaylistInitDataThe data to initialize a playlist

public debug(m): boolean

ParameterTypeOptional
mstring

public destroy(): Promise<void>

Destroy every single queues managed by this master player instance

public emit(name, args): boolean

ParameterTypeOptional
nameK
argsParameters<PlayerEvents[K]>

public eventNames(): Array<U>

public generateStatistics(): GuildQueueStatistics

Generates statistics that could be useful. Statistics generator is still experimental.

public getMaxListeners(): number

public handleVoiceState(oldState, newState): void

Handles voice state update

ParameterTypeOptionalDescription
oldStateVoiceStateThe old voice state
newStateVoiceStateThe new voice state

public isCompatMode(): boolean

Whether the player is in compatibility mode. Compatibility mode is enabled when non-discord.js client is used.

public isVoiceStateHandlerLocked(): boolean

Checks if voice state handler is locked.

public listenerCount(type): number

ParameterTypeOptional
typekeyof PlayerEvents

public listeners(type): Array<PlayerEvents[U]>

ParameterTypeOptional
typeU

public lockVoiceStateHandler(): void

Lock voice state handler. When this method is called, discord-player will keep using the default voice state update handler, even if custom implementation exists.

public off(name, listener): Player

ParameterTypeOptional
nameK
listenerPlayerEvents[K]

public on(name, listener): Player

ParameterTypeOptional
nameK
listenerPlayerEvents[K]

public onVoiceStateUpdate(handler): void

Override default voice state update handler

ParameterTypeOptionalDescription
handlerVoiceStateHandlerThe handler callback

public once(name, listener): Player

ParameterTypeOptional
nameK
listenerPlayerEvents[K]

public play(channel, query, options): Promise<PlayerNodeInitializationResult<T>>

Initiate audio player

ParameterTypeOptionalDescription
channelGuildVoiceChannelResolvableThe voice channel on which the music should be played
queryTrackLikeThe track or source to play
optionsPlayerNodeInitializerOptions<T>Options for player

public prependListener(event, listener): this

ParameterTypeOptional
eventU
listenerPlayerEvents[U]

public prependOnceListener(event, listener): this

ParameterTypeOptional
eventU
listenerPlayerEvents[U]

public rawListeners(type): Array<PlayerEvents[U]>

ParameterTypeOptional
typeU

public removeAllListeners(name?): Player

ParameterTypeOptional
nameK

public removeListener(name, listener): Player

ParameterTypeOptional
nameK
listenerPlayerEvents[K]

public scanDeps(): string

Generates a report of the dependencies used by the discord-voip module. Useful for debugging.

public search(searchQuery, options): Promise<SearchResult>

Search tracks

ParameterTypeOptionalDescription
searchQuerystring | Playlist | Track<unknown>Array<Track<unknown>>SearchResultN/A
optionsSearchOptionsThe search options

public setMaxListeners(n): this

ParameterTypeOptional
nnumber

public unlockVoiceStateHandler(): void

Unlock voice state handler. When this method is called, discord-player will stop using the default voice state update handler if custom implementation exists.

public static create(client, options): Player

Creates new discord-player instance.

ParameterTypeOptionalDescription
clientClient<boolean>The client that instantiated player
optionsPlayerInitOptionsPlayer initializer options

On this page

Player extends PlayerEventsEmitter<PlayerEvents>Propertiespublic client: anypublic events: anypublic extractors: anypublic id: anypublic lyrics: anypublic nodes: anypublic options: anypublic requiredEvents: anypublic version: anypublic voiceUtils: anypublic static defaultMaxListeners: anypublic static version: anypublic context: anypublic eventLoopLag: anypublic hasDebugger: anypublic queryCache: anypublic queues: anyMethodspublic [iterator](): Generator<GuildQueue<unknown>void | unknown>public addListener(name, listener): Playerpublic createPlaylist(data): Playlistpublic debug(m): booleanpublic destroy(): Promise<void>public emit(name, args): booleanpublic eventNames(): Array<U>public generateStatistics(): GuildQueueStatisticspublic getMaxListeners(): numberpublic handleVoiceState(oldState, newState): voidpublic isCompatMode(): booleanpublic isVoiceStateHandlerLocked(): booleanpublic listenerCount(type): numberpublic listeners(type): Array<PlayerEvents[U]>public lockVoiceStateHandler(): voidpublic off(name, listener): Playerpublic on(name, listener): Playerpublic onVoiceStateUpdate(handler): voidpublic once(name, listener): Playerpublic play(channel, query, options): Promise<PlayerNodeInitializationResult<T>>public prependListener(event, listener): thispublic prependOnceListener(event, listener): thispublic rawListeners(type): Array<PlayerEvents[U]>public removeAllListeners(name?): Playerpublic removeListener(name, listener): Playerpublic scanDeps(): stringpublic search(searchQuery, options): Promise<SearchResult>public setMaxListeners(n): thispublic unlockVoiceStateHandler(): voidpublic static create(client, options): Player