New Classes: ShoukakuTrack & ShoukakuTrackList
ShoukakuRest's resolve method now returns ShoukakuTrackList instead of a random object. This should make things easier for developers. Example below
Shoukaku.getNode().resolve('https://www.youtube.com/watch?v=K7RdzkDX1vY')
.then(TrackList => {
if (!TrackList) return;
const ShoukakuTrack = TrackList.tracks.shift();
ShoukakuPlayer.play(ShoukakuTrack.track) ;
console.log('Now Playing: ' + ShoukakuTrack.info.title);
});
// Plox read documentation as I fully documented this thing there
Documentation Fixes
Typescript typings fixes and new additions
ShoukakuResolver class is now renamed to ShoukakuRest
While ShoukakuResolver got its name changed, basic usage didn't change
New Methods for ShoukakuRest, they are listed below
ShoukakuRest.getRoutePlannerStatus(); // gets the status of your route planner nano rotation (for latest ll builds)
ShoukakuRest.unmarkFailedAddress('ip_here'); // unmarks a failed ip on your route planner (for latest ll builds)
ShoukakuRest.unmarkAllFailedAddress(); // unmarks all failed ip on your route planner (for latest ll builds)
Master Compatibility change, Not compatible with commits older than
https://github.com/discordjs/discord.js/commit/5519d6fbaa61abccc27b742f97ad725bf4259265
Note, while I did say Master Compatibility change, it might work with older commits than what I mentioned above. But it's not my problem if it doesn't work.
Shoukaku#start()
is removed, hence no need to callShoukaku#start()
on ready event.
ShoukakuConstants#ShoukakuBuildOptions
is removed.
Added
ShoukakuConstants#ShoukakuNodes
, which is an array ofShoukakuConstants#ShoukakuNodeOptions
.
Shoukaku
class gained a new parameter namednodes
which is theShoukakuConstants#ShoukakuNodes
. Parameters order have been changed, the example below shows the change.
Example:
const servers = [{
name: 'Lewd Server',
host: 'localhost',
port: 6969,
auth: 'do not guess my password'
}];
new Shoukaku(client, servers, {
moveOnDisconnect: false,
resumable: 'resumableKongou',
resumableTimeout: 30,
reconnectTries: 2,
restTimeout: 10000
})
ShoukakuSocket#leaveVoiceChannel('guild_id');
is added and can be used to remove players. Although I recommendShoukakuPlayer#disconnect();
if you have a reference of ShoukakuPlayer.
ShoukakuPlayer#node
property is removed.
Automatic Node Switching on disconnect is added, and can be enabled via
moveOnDisconnect
onShoukakuOptions
ShoukakuPlayer#moveToNode('node_name');
is added and can be used to move players across your lavalink nodes.
0.2.x and earlier
Shoukaku#build({ /* buildOptions here */ });
1.0.0 and newer
Shoukaku#start({ /* buildOptions here */ });
ShoukakuLink
is now a property ofShoukakuPlayer
, meaning all link related getters are changed to player getters.
You can access
ShoukakuLink
viaShoukakuPlayer#voiceConnection
Shoukaku's events on players are changed, and here are the events.
// Events that I highly recommend YOU to handle
ShoukakuPlayer.on('end', () => {}); // Emitted when track finishes playing
ShoukakuPlayer.on('closed', () => {}); // Emitted when the voice websocket closed
ShoukakuPlayer.on('error', () => {}); // Emitted when an error happened during trying to do something
ShoukakuPlayer.on('nodeDisconnect', () => {}); // Emitted when the node disconnected and when Shoukaku can't migrate the player to another node
// Events that I think you can leave out
ShoukakuPlayer.on('trackException', () => {}); // Emitted when Lavalink did an ooopsie. Will automatically emit end for you
ShoukakuPlayer.on('resumed', () => {}); // Emitted when the lost connection on Lavalink Node was reconnected, and the player resumed
ShoukakuPlayer.on('playerUpdate', () => {}); // Emitted when there is a player update data from Lavalink
Shoukaku class have renamed methods and properties
Shoukaku#getLink()
->Shoukaku#getPlayer()
Shoukaku#links
->Shoukaku#players
Shoukaku#totalLinks
->Shoukaku#totalPlayers
ShoukakuSocket also have a renamed property
ShoukakuSocket#links
->ShoukakuSocket#players
Instead of player being ShoukakuLink's property, ShoukakuLink became a property of ShoukakuPlayer, making the code more concise. Example below.
// 0.1.x and earlier
ShoukakuLink.player.playTrack();
ShoukakuLink.disconnect();
// 0.2.x
ShoukakuPlayer.playTrack();
ShoukakuPlayer.disconnect();