Player extends PlayerEventsEmitter<PlayerEvents>
new Player(client, options)
Parameter | Type | Optional | Description |
---|---|---|---|
client | Client<boolean> | β | The Discord Client |
options | PlayerInitOptions | β | The player init options |
Properties
private #lagMonitorInterval: Timer
private #lagMonitorTimeout: Timeout
private #lastLatency: number
private #voiceStateUpdateListener: (oldState: VoiceState, newState: VoiceState) => void
public client: Client<boolean>
public events: PlayerEventsEmitter<GuildQueueEvents<unknown>>
public extractors: ExtractorExecutionContext
public id: string
public nodes: GuildNodeManager<unknown>
public options: PlayerInitOptions
public requiredEvents: Array<keyof PlayerEvents>
public voiceUtils: VoiceUtils
public static _singletonKey: symbol
public static defaultMaxListeners: number
- Source:
packages/utils/dist/index.d.ts#L42
public eventLoopLag: number
Event loop lag
public queryCache: null | QueryCache
The current query cache provider
public queues: GuildNodeManager<unknown>
Alias to
Methods
public [iterator](): Generator<GuildQueue<unknown>, void, undefined>
private _handleVoiceState(oldState, newState): undefined
Parameter | Type | Optional | Description |
---|---|---|---|
oldState | VoiceState | β | - |
newState | VoiceState | β | - |
public addListener(event, listener): Player
Parameter | Type | Optional | Description |
---|---|---|---|
event | U | β | - |
listener | PlayerEvents[U] | β | - |
- Source:
packages/utils/dist/index.d.ts#L44
public createPlaylist(data): Playlist
Creates
Parameter | Type | Optional | Description |
---|---|---|---|
data | PlaylistInitData | β | The data to initialize a playlist |
public debug(m): boolean
Parameter | Type | Optional | Description |
---|---|---|---|
m | string | β | - |
public destroy(): Promise<void>
Destroy player
public emit(name, args): boolean
Parameter | Type | Optional | Description |
---|---|---|---|
name | K | β | - |
args | Parameters<PlayerEvents[K]> | β | - |
public eventNames(): Array<U>
- Source:
packages/utils/dist/index.d.ts#L53
public generateStatistics(): { instances: number,queryCacheEnabled: boolean,queues: Array<GuildQueueStatisticsMetadata>,queuesCount: number }
Generates statistics
public getMaxListeners(): number
- Source:
packages/utils/dist/index.d.ts#L57
public handleVoiceState(oldState, newState): void
Handles voice state update
Parameter | Type | Optional | Description |
---|---|---|---|
oldState | VoiceState | β | The old voice state |
newState | VoiceState | β | The new voice state |
public isVoiceStateHandlerLocked(): boolean
Checks if voice state handler is locked
public listenerCount(type): number
Parameter | Type | Optional | Description |
---|---|---|---|
type | keyof PlayerEvents | β | - |
- Source:
packages/utils/dist/index.d.ts#L54
public listeners(type): Array<PlayerEvents[U]>
Parameter | Type | Optional | Description |
---|---|---|---|
type | U | β | - |
- Source:
packages/utils/dist/index.d.ts#L55
public lockVoiceStateHandler(): void
Lock voice state handler
public off(event, listener): Player
Parameter | Type | Optional | Description |
---|---|---|---|
event | U | β | - |
listener | PlayerEvents[U] | β | - |
- Source:
packages/utils/dist/index.d.ts#L51
public on(event, listener): Player
Parameter | Type | Optional | Description |
---|---|---|---|
event | U | β | - |
listener | PlayerEvents[U] | β | - |
- Source:
packages/utils/dist/index.d.ts#L50
public once(event, listener): Player
Parameter | Type | Optional | Description |
---|---|---|---|
event | U | β | - |
listener | PlayerEvents[U] | β | - |
- Source:
packages/utils/dist/index.d.ts#L49
public play(channel, query, options): Promise<{ extractor: null | BaseExtractor,queue: GuildQueue<T>,searchResult: SearchResult,track: Track }>
Initiate audio player
Parameter | Type | Optional | Description |
---|---|---|---|
channel | GuildVoiceChannelResolvable | β | The voice channel on which the music should be played |
query | string | Track | SearchResult | β | The track or source to play |
options | SearchOptions & { afterSearch: (result: SearchResult) => Promise<SearchResult>,connectionOptions: VoiceConnectConfig,nodeOptions: GuildNodeCreateOptions<T> } | β | Options for player |
public prependListener(event, listener): Player
Parameter | Type | Optional | Description |
---|---|---|---|
event | U | β | - |
listener | PlayerEvents[U] | β | - |
- Source:
packages/utils/dist/index.d.ts#L45
public prependOnceListener(event, listener): Player
Parameter | Type | Optional | Description |
---|---|---|---|
event | U | β | - |
listener | PlayerEvents[U] | β | - |
- Source:
packages/utils/dist/index.d.ts#L46
public rawListeners(type): Array<PlayerEvents[U]>
Parameter | Type | Optional | Description |
---|---|---|---|
type | U | β | - |
- Source:
packages/utils/dist/index.d.ts#L56
public removeAllListeners(event?): Player
Parameter | Type | Optional | Description |
---|---|---|---|
event | keyof PlayerEvents | β | - |
- Source:
packages/utils/dist/index.d.ts#L48
public removeListener(event, listener): Player
Parameter | Type | Optional | Description |
---|---|---|---|
event | U | β | - |
listener | PlayerEvents[U] | β | - |
- Source:
packages/utils/dist/index.d.ts#L47
public scanDeps(): string
Generates a report of the dependencies used by the
public search(query, options): Promise<SearchResult>
Search tracks
Parameter | Type | Optional | Description |
---|---|---|---|
query | string | Track | β | The search query |
options | SearchOptions | β | The search options |
public setMaxListeners(n): Player
Parameter | Type | Optional | Description |
---|---|---|---|
n | number | β | - |
- Source:
packages/utils/dist/index.d.ts#L58
public unlockVoiceStateHandler(): void
Unlock voice state handler
public static clearAllPlayers(): void
Clear all player instances
public static getAllPlayers(): Array<Player>
Get all active player instances
public static singleton(client, options): Player
Creates discord-player singleton instance.
Parameter | Type | Optional | Description |
---|---|---|---|
client | Client<boolean> | β | The client that instantiated player |
options | PlayerInitOptions | β | Player initializer options |