Player
Wrapper object around Lavalink
Extends
Constructors
new Player()
Parameters
Parameter | Type |
---|---|
guildId | string |
node | Node |
Returns
Overrides
TypedEventEmitter<PlayerEvents>.constructor
Defined in
shoukaku/src/guild/Player.ts:207
Properties
filters
Filters on current track
Defined in
shoukaku/src/guild/Player.ts:205
guildId
GuildId of this player
Defined in
shoukaku/src/guild/Player.ts:177
node
Lavalink node this player is connected to
Defined in
shoukaku/src/guild/Player.ts:181
paused
Pause status in current player
Defined in
shoukaku/src/guild/Player.ts:193
ping
Ping represents the number of milliseconds between heartbeat and ack. Could be -1
if not connected
Defined in
shoukaku/src/guild/Player.ts:197
position
Position in ms of current track
Defined in
shoukaku/src/guild/Player.ts:201
track
Base64 encoded data of the current track
Defined in
shoukaku/src/guild/Player.ts:185
volume
Global volume of the player
Defined in
shoukaku/src/guild/Player.ts:189
Accessors
data
Returns
Defined in
shoukaku/src/guild/Player.ts:219
Methods
clearFilters()
Clear all filters applied to the currently playing track
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:408
destroy()
Destroys the player in remote lavalink side
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:274
emit()
Synchronously calls each of the listeners registered for the event named eventName
, in the order they were registered, passing the supplied arguments
to each.
Returns true
if the event had listeners, false
otherwise.
Type Parameters
Type Parameter |
---|
K extends symbol | keyof PlayerEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
…args | PlayerEvents [Extract <K , string >] |
Returns
boolean
Inherited from
Since
v0.1.26
Defined in
move()
Move player to another node
Parameters
Parameter | Type | Description |
---|---|---|
name ? | string | Name of node to move to, or the default ideal node |
Returns
Promise
<boolean
>
true if the player was moved, false if not
Defined in
shoukaku/src/guild/Player.ts:245
off()
Alias for emitter.removeListener()
.
Type Parameters
Type Parameter |
---|
K extends symbol | keyof PlayerEvents |
Parameters
Parameter | Type |
---|---|
eventName | K |
listener | (…args : PlayerEvents [Extract <K , string >]) => void |
Returns
this
Inherited from
Since
v10.0.0
Defined in
on()
Adds the listener
function to the end of the listeners array for the event
named eventName
. No checks are made to see if the listener
has already
been added. Multiple calls passing the same combination of eventName
and
listener
will result in the listener
being added, and called, multiple times.
Returns a reference to the EventEmitter
, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependListener()
method can be used as an alternative to add the
event listener to the beginning of the listeners array.
Type Parameters
Type Parameter |
---|
K extends symbol | keyof PlayerEvents |
Parameters
Parameter | Type | Description |
---|---|---|
eventName | K | The name of the event. |
listener | (…args : PlayerEvents [Extract <K , string >]) => void | The callback function |
Returns
this
Inherited from
Since
v0.1.101
Defined in
onPlayerUpdate()
Handle player update data
Parameters
Parameter | Type |
---|---|
json | PlayerUpdate |
Returns
void
Defined in
shoukaku/src/guild/Player.ts:508
once()
Adds a one-time listener
function for the event named eventName
. The
next time eventName
is triggered, this listener is removed and then invoked.
Returns a reference to the EventEmitter
, so that calls can be chained.
By default, event listeners are invoked in the order they are added. The emitter.prependOnceListener()
method can be used as an alternative to add the
event listener to the beginning of the listeners array.
Type Parameters
Type Parameter |
---|
K extends symbol | keyof PlayerEvents |
Parameters
Parameter | Type | Description |
---|---|---|
eventName | K | The name of the event. |
listener | (…args : PlayerEvents [Extract <K , string >]) => void | The callback function |
Returns
this
Inherited from
Since
v0.3.0
Defined in
playTrack()
Play a new track
Parameters
Parameter | Type | Default value |
---|---|---|
playerOptions | PlayOptions | undefined |
noReplace | boolean | false |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:281
resume()
Resumes the current track
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
options | ResumeOptions | {} | An object that conforms to ResumeOptions that specify behavior on resuming |
noReplace | boolean | false | Set it to true if you don’t want to replace the currently playing track |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:428
seekTo()
Seek to a specific time in the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
position | number | Position to seek to in milliseconds |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:304
setChannelMix()
Change the channel mix settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
channelMix ? | ChannelMixSettings | An object that conforms to ChannelMixSettings that defines how much the left and right channels affect each other (setting all factors to 0.5 causes both channels to get the same audio) |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:385
setDistortion()
Change the distortion settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
distortion ? | DistortionSettings | An object that conforms to DistortionSettings that defines distortions in the audio |
Returns
Promise
<void
>
The current player instance
Defined in
shoukaku/src/guild/Player.ts:377
setEqualizer()
Change the equalizer settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
equalizer | Band [] | An array of objects that conforms to the Bands type that define volumes at different frequencies |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:328
setFilterVolume()
Sets the filter volume of the player
Parameters
Parameter | Type | Description |
---|---|---|
volume | number | Target volume 0.0-5.0 |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:320
setFilters()
Change the all filter settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
filters | FilterOptions | An object that conforms to FilterOptions that defines all filters to apply/modify |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:401
setGlobalVolume()
Sets the global volume of the player
Parameters
Parameter | Type | Description |
---|---|---|
volume | number | Target volume 0-1000 |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:312
setKaraoke()
Change the karaoke settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
karaoke ? | KaraokeSettings | An object that conforms to the KaraokeSettings type that defines a range of frequencies to mute |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:336
setLowPass()
Change the low pass settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
lowPass ? | LowPassSettings | An object that conforms to LowPassSettings that defines the amount of suppression on higher frequencies |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:393
setPaused()
Pause or unpause the currently playing track
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
paused | boolean | true | Boolean value to specify whether to pause or unpause the current bot user |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:296
setRotation()
Change the rotation settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
rotation ? | RotationSettings | An object that conforms to the RotationSettings type that defines the frequency of audio rotating round the listener |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:368
setTimescale()
Change the timescale settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
timescale ? | TimescaleSettings | An object that conforms to the TimescaleSettings type that defines the time signature to play the audio at |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:344
setTremolo()
Change the tremolo settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
tremolo ? | FreqSettings | An object that conforms to the FreqSettings type that defines an oscillation in volume |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:352
setVibrato()
Change the vibrato settings applied to the currently playing track
Parameters
Parameter | Type | Description |
---|---|---|
vibrato ? | FreqSettings | An object that conforms to the FreqSettings type that defines an oscillation in pitch |
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:360
stopTrack()
Stop the currently playing track
Returns
Promise
<void
>
Defined in
shoukaku/src/guild/Player.ts:288
update()
If you want to update the whole player yourself, sends raw update player info to lavalink
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
playerOptions | UpdatePlayerOptions | undefined | Options to update the player data |
noReplace | boolean | false | Set it to true if you don’t want to replace the currently playing track |
Returns
Promise
<void
>