<,<
This commit is contained in:
@@ -25,18 +25,19 @@ class MusicPlayer {
|
||||
return this.players.get(guildId);
|
||||
}
|
||||
|
||||
// Get Shoukaku node
|
||||
const node = this.client.shoukaku.options.nodeResolver(this.client.shoukaku.nodes);
|
||||
if (!node) {
|
||||
throw new Error('No available Lavalink nodes!');
|
||||
}
|
||||
// Get Shoukaku instance and node
|
||||
const shoukaku = this.client.shoukaku; // Get the main shoukaku instance
|
||||
const node = shoukaku.options.nodeResolver(shoukaku.nodes);
|
||||
if (!node) {
|
||||
throw new Error('No available Lavalink nodes!');
|
||||
}
|
||||
|
||||
try {
|
||||
// Create a new connection to the voice channel
|
||||
const connection = await this.client.shoukaku.joinVoiceChannel({
|
||||
guildId: guildId,
|
||||
channelId: voiceChannel,
|
||||
shardId: 0,
|
||||
try {
|
||||
// Create a new connection to the voice channel using the shoukaku instance
|
||||
const connection = await shoukaku.joinVoiceChannel({
|
||||
guildId: guildId,
|
||||
channelId: voiceChannel,
|
||||
shardId: 0, // Assuming shardId 0, adjust if sharding
|
||||
deaf: true
|
||||
});
|
||||
|
||||
@@ -100,10 +101,12 @@ class MusicPlayer {
|
||||
return this;
|
||||
},
|
||||
|
||||
shoukaku: shoukaku, // Store shoukaku instance on the player object
|
||||
|
||||
// Destroy the player and disconnect
|
||||
destroy() {
|
||||
// Use the main Shoukaku instance to leave the channel
|
||||
this.client.shoukaku.leaveVoiceChannel(this.guild);
|
||||
// Use the stored Shoukaku instance to leave the channel
|
||||
this.shoukaku.leaveVoiceChannel(this.guild);
|
||||
// Remove the player instance from the manager's map
|
||||
musicPlayer.players.delete(this.guild);
|
||||
logger.debug(`Destroyed player for guild ${this.guild}`);
|
||||
|
||||
Reference in New Issue
Block a user