Table of Contentsโ
| Property | Type | Description |
|---|
autoplayTries | number | The number of autoplay tries. |
bands | EqualizerBand[] | The equalizer bands. |
clusterId | number | The cluster ID. |
dynamicRepeat | boolean | The dynamic repeat state. |
filters | Filters | The filters. |
guildId | string | The guild ID the Player belongs to. |
isAutoplay | boolean | Whether autoplay is enabled. |
manager | Manager | The Manager instance. |
node | Node | The Node instance. |
nowPlayingMessage | Message | The now playing message. |
paused | boolean | Whether the player is paused. |
playing | boolean | Whether the player is playing. |
position | number | The player position. |
queue | Queue | The queue. |
queueRepeat | boolean | The queue repeat state. |
state | StateTypes | The player state. |
textChannelId | string | The text channel id the Player is bound to. |
trackRepeat | boolean | The track repeat state. |
voiceChannelId | string | The voice channel id the Player is bound to. |
voiceState | VoiceState | The voice state the Player is in. |
volume | number | The player volume. |
new Player(options: PlayerOptions)
| Parameter | Type | Description | Optional |
|---|
options | PlayerOptions | The player options. | |
async autoMoveNode(): Promise<Player | void>
Automatically moves the player to an usable node.
| Type | Description |
|---|
Promise<Player | void> | The player. |
Connects the player to the voice channel.
โ ๏ธ This method only works when the players node has the sponsor block plugin.
async deleteSponsorBlock(): Promise<void>
Deletes the sponsor block.
async destroy(disconnect: boolean = true): Promise<boolean>
Destroys the player.
| Parameter | Type | Description | Optional |
|---|
disconnect | boolean | Whether to disconnect the player from the voice channel. | |
| Type | Description |
|---|
| Promise<boolean> | Whether the player was successfully destroyed. |
async disconnect(): Promise<void>
Disconnects the player from the voice channel.
Retrieves custom data associated with a given key.
| Parameter | Type | Description | Optional |
|---|
key | string | The key to get the value from. | |
| Type | Description |
|---|
any | The value. |
โ ๏ธ This method only works when the players node has the LavaLyrics plugin.
async getCurrentLyrics(skipTrackSource: boolean = false): Promise<Lyrics>
Retrieves the current lyrics for the playing track.
| Parameter | Type | Description | Optional |
|---|
skipTrackSource | boolean | Whether to skip the track source. | |
| Type | Description |
|---|
Promise<Lyrics> | The lyrics. |
async getRecommendedTracks(track: Track): Promise<Track[]>
Retrieves recommended tracks for the current track.
| Parameter | Type | Description | Optional |
|---|
track | Track | The track to get recommended tracks for. | |
| Type | Description |
|---|
Promise<Track[]> | The recommended tracks. |
โ ๏ธ This method only works when the players node has the sponsor block plugin.
async getSponsorBlock(): Promise<SponsorBlockSegment[]>
Gets the sponsorblock for the player.
init(manager: Manager): void
Initializes the player.
| Parameter | Type | Description | Optional |
|---|
manager | Manager | The manager instance. | |
async moveNode(identifier: string): Promise<Player>
Moves the player to a different node.
| Parameter | Type | Description | Optional |
|---|
identifier | string | The node identifier to move the player to. | |
| Type | Description |
|---|
Promise<Player> | The player. |
async pause(pause: boolean): Promise<this>
Pauses the player.
| Parameter | Type | Description | Optional |
|---|
pause | boolean | Whether to pause the player. | |
| Type | Description |
|---|
Promise<this> | The player. |
async play(): Promise<Player>
async play(track: Track): Promise<Player>
async play(options: PlayOptions): Promise<Player>
async play(track: Track, options: PlayOptions): Promise<Player>
Plays a track or starts playback with the specified options.
| Parameter | Type | Description | Optional |
|---|
track | Track | The track to play. | |
options | PlayOptions | The play options. | |
| Type | Description |
|---|
Promise<Player> | The player. |
async previous(): Promise<this>
Skips to the previous track in the queue.
| Type | Description |
|---|
Promise<this> | The player. |
โ ๏ธ This method only works when a player is connected to a NodeLink node.
async removeVoiceReceiver(): Promise<void>
Removes the voice receiver from the player.
async restart(): Promise<Player>
Restarts the current track.
| Type | Description |
|---|
Promise<Player> | The player. |
async search<T = unknown>(query: string | SearchQuery, requester?: T): Promise<SearchResult>
Searches for tracks based on the query.
| Parameter | Type | Description | Optional |
|---|
query | string | SearchQuery | The query to search for. | |
requester | T | The requester. | |
async seek(position: number): Promise<Player>
Seeks to the specified position in the current track.
| Parameter | Type | Description | Optional |
|---|
position | number | The position to seek to. | |
| Type | Description |
|---|
Promise<Player> | The player. |
set(key: string, value: unknown): void
Sets a custom property on the player.
| Parameter | Type | Description | Optional |
|---|
key | string | The key to set. | |
value | unknown | The value to set. | |
| Type | Description |
|---|
| void | The player. |
setAutoplay<T = unknown>(autoplayState: boolean, AutoplayUser?: T, tries?: number): this
Sets the autoplay option on the player.
| Parameter | Type | Description | Optional |
|---|
autoplayState | boolean | The autoplay option. | |
AutoplayUser | T | The bot user. | |
tries | number | The number of tries. | |
| Type | Description |
|---|
this | The player. |
async setDynamicRepeat(repeat: boolean, ms: number): Promise<this>
Sets the dynamic repeat option on the player.
| Parameter | Type | Description | Optional |
|---|
repeat | boolean | The dynamic repeat option. | |
ms | number | The time in milliseconds. | |
| Type | Description |
|---|
Promise<this> | The player. |
setNowPlayingMessage<T = Message>(message: T): Message
Sets the now playing message on the player.
| Parameter | Type | Description | Optional |
|---|
message | Message | The now playing message. | |
| Type | Description |
|---|
| Message | The now playing message. |
setQueueRepeat(repeat: boolean): this
Sets the queue repeat option on the player.
| Parameter | Type | Description | Optional |
|---|
repeat | boolean | The queue repeat option. | |
| Type | Description |
|---|
this | The player. |
โ ๏ธ This method only works when the players node has the sponsor block plugin.
async setSponsorBlock(segments: SponsorBlockSegment[] = [SponsorBlockSegment.Sponsor, SponsorBlockSegment.SelfPromo]): Promise<void>
Sets the sponsor block segments on the player.
setTextChannelId()โ
setTextChannelId(channel: string): this
Sets the text channel id on the player.
| Parameter | Type | Description | Optional |
|---|
channel | string | The text channel id. | |
| Type | Description |
|---|
this | The player. |
setTrackRepeat(repeat: boolean): this
Sets the track repeat option on the player.
| Parameter | Type | Description | Optional |
|---|
repeat | boolean | The track repeat option. | |
| Type | Description |
|---|
this | The player. |
setVoiceChannelId(channel: string): this
Sets the voice channel id on the player.
| Parameter | Type | Description | Optional |
|---|
channel | string | The voice channel id. | |
| Type | Description |
|---|
this | The player. |
async setVolume(volume: number): Promise<this>
Sets the volume on the player.
| Parameter | Type | Description | Optional |
|---|
volume | number | The volume. | |
| Type | Description |
|---|
this | The player. |
โ ๏ธ This method only works when a player is connected to a NodeLink node.
async setupVoiceReceiver(): Promise<void>
Sets up the voice receiver on the player.
async stop(amount?: number): Promise<this>
Stops the player and optionally removes tracks from the queue.
| Parameter | Type | Description | Optional |
|---|
amount | number | The amount of tracks to remove from the queue. | |
| Type | Description |
|---|
Promise<this> | The player. |
async switchGuild(newOptions: PlayerOptions, force: boolean = false): Promise<Player>
Switches the guild on the player.
| Parameter | Type | Description | Optional |
|---|
newOptions | PlayerOptions | The new options for the player. | |
force | boolean | Whether to force the switch. | |
| Type | Description |
|---|
Promise<Player> | The player. |