fix(lavalink): Correct Lavalink connection URL format and update deprecated code
This commit is contained in:
@@ -26,14 +26,14 @@ class MusicPlayer {
|
||||
}
|
||||
|
||||
// Get Shoukaku node
|
||||
const node = this.client.shoukaku.getNode();
|
||||
const node = this.client.shoukaku.options.nodeResolver(this.client.shoukaku.nodes);
|
||||
if (!node) {
|
||||
throw new Error('No available Lavalink nodes!');
|
||||
}
|
||||
|
||||
try {
|
||||
// Create a new connection to the voice channel
|
||||
const connection = await node.joinChannel({
|
||||
const connection = await this.client.shoukaku.joinVoiceChannel({
|
||||
guildId: guildId,
|
||||
channelId: voiceChannel,
|
||||
shardId: 0,
|
||||
@@ -56,7 +56,7 @@ class MusicPlayer {
|
||||
this.current = track;
|
||||
|
||||
// Start playback
|
||||
await this.connection.playTrack({ track: track.track });
|
||||
await this.connection.playTrack({ track: track.encoded });
|
||||
this.playing = true;
|
||||
|
||||
return this;
|
||||
@@ -207,7 +207,8 @@ class MusicPlayer {
|
||||
* @returns {Promise<Array>} Array of track objects
|
||||
*/
|
||||
async search({ query, requester }) {
|
||||
const node = this.client.shoukaku.getNode();
|
||||
// Get the first available node
|
||||
const node = this.client.shoukaku.options.nodeResolver(this.client.shoukaku.nodes);
|
||||
if (!node) throw new Error('No available Lavalink nodes!');
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user