Common Actions on Player/Queue
Learn how to perform common actions on the player and queue
Here are few basic examples on how to implement various actions.
This guide assumes that you already initialized the player in your index.js or corresponding file.
Also this does not perform checks on the current status of the queue. Refer to one of the example bots for more detailed info.
Getting the player instance from anywhere
Playing a new track
If you are not using player.play() and handling queue creation as well as other logic on your own, you may need to use AsyncQueue on your command, otherwise you may face this issue:
Inserting a new track to a specific position in queue
Removing a track from the queue
Getting the current queue
Pausing the queue
This example shows how you can toggle the pause state for a queue with a single command
Going back a track
If your queue is being looped then there won't be any tracks in history
Skipping a track
Shuffling the queue
Looping the queue
These are the various options for Loop Modes
| Mode | Value | Description |
|---|---|---|
| Off | 0 | Default mode with no loop active |
| Track | 1 | Loops the current track |
| Queue | 2 | Loops the current queue |
| Autoplay | 3 | Play related songs automatically based on your existing queue |
Changing the volume of the player
Stopping the queue
Controlling the player behavior
You can find the whole list of available nodeOptions from GuildNodeCreateOptions