Constructor
new Player(guildId)
Parameters:
Name | Type | Description |
---|---|---|
guildId |
GuildID |
Methods
addTrack(track) → {Number}
Add a track to the queue
Parameters:
Name | Type | Description |
---|---|---|
track |
Track | The track to be added to the queue |
Returns:
The queue length
- Type
- Number
(async) addTrackNice(guildId, track, dontStartPlayeropt, createopt) → {Object}
Adds the tracks to the queue, can be configured to start or create the player
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
guildId |
GuildID | |||
track |
Track | Array.<Track> | The track(s) to add | ||
dontStartPlayer |
Boolean |
<optional> |
false | Set to true if the player should start playing if nothing else is |
create |
Boolean |
<optional> |
true | Set to false if the player shouldn't be created |
Returns:
Info about added
- Type
- Object
getQueue(startopt, stopopt, infoopt) → {object}
Gets the current queue
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
start |
Number |
<optional> |
0 | Index to start from |
stop |
Number |
<optional> |
-1 | Index to end on |
info |
Boolean |
<optional> |
true | Include the whole Track object, or just the info |
Returns:
The queue object
- Type
- object
(async) join(voiceChannel)
Join a voice channel
Parameters:
Name | Type | Description |
---|---|---|
voiceChannel |
VoiceChannel | discord.js voiceChannel object to join |
(async) joinNice(voiceChannel, forceJoinopt)
Join a voice channel with extra options
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
voiceChannel |
VoiceChannel | |||
forceJoin |
Boolean |
<optional> |
false | If it should try to connect, even when connected |
(async) pause() → {Promise.<boolean>}
Pauses the playback
Returns:
True if it could pause
- Type
- Promise.<boolean>
removeFromQueue(uid)
Removes a track from the queue using uid's
Parameters:
Name | Type | Description |
---|---|---|
uid |
String | a tracks unique id |
setRepeat(modeopt)
Set the repeat mode
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
mode |
String |
<optional> |
"none" | "none|all|single" |
shuffleQueue()
Shuffles the queue
skipCurrentTrack()
Skip the currently playing track.
(async) startNextTrack(shiftopt, preloadNextopt) → {Promise.<?Track>}
Starts the next track
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
shift |
Boolean |
<optional> |
false | If the player should play the next element in the queue, or restart the current. Ignored if player.repeat is "single" |
preloadNext |
Boolean |
<optional> |
true | If the player should preload the next track for quicker playback. |
Returns:
The track that started playing.
- Type
- Promise.<?Track>
(async) unpause() → {Promise.<boolean>}
Unpauses the playback
Returns:
True if it could unpause
- Type
- Promise.<boolean>
Events
joinedVoiceChannel
Player joined a voice channel
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
player |
Player |
playerCreated
Player created event.
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
player |
Player |
playerDestroyed
Player was destroyed
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
guildId |
GuildID |
playingTrack
Player started playing a track.
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
player |
Player | |
track |
Track | The track that was started |
skippedTrack
Player skipped track
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
player |
Player |
trackEnded
Player started playing a track.
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
player |
Player | |
track |
Track | The track that was started |