Attempt to fix sound player disconnect issue

This commit is contained in:
Essem 2022-10-24 22:03:57 -05:00
parent 8144a7a115
commit 5d8ecbf90a
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
2 changed files with 54 additions and 30 deletions

17
events/shardReady.js Normal file
View file

@ -0,0 +1,17 @@
import { players, errHandle } from "../utils/soundplayer.js";
export default async (client, id) => {
for (const player of players.values()) {
if (id !== player.voiceChannel.guild.shard.id) return;
try {
await player.player.connection.connect({
guildId: player.voiceChannel.guildID,
channelId: player.voiceChannel.id,
shardId: player.voiceChannel.guild.shard.id,
deaf: true
});
} catch (e) {
errHandle(e, client, player.player, player.playingMessage, player.voiceChannel, { type: "classic" }, true);
}
}
};