Join a voice channel, search for a track, play the track, then disconnect after 30 seconds
Tell Lavalink to join a Discord voice channel.
Determine which Node to use.
Search for a track, here we are searching via SoundCloud, using the scsearch: prefix. The string after the prefix is the search query.
Tell Lavalink to play the searched track.
After 30 seconds, tell Lavalink to leave the voice channel.
Playing a track and changing a playback option
Here we are changing the volume, you can do other stuff as well.
You can also update the player without using helper functions
Custom function to get the ideal node
When executing any action, an API endpoint is called on a Lavalink node. When there are many nodes passed in the configuration, some logic is used to select the node to perform actions on.