finally fixed dumb joinvoice error

This commit is contained in:
Histmy 2022-12-18 17:04:23 +01:00
parent dc7c70d0c0
commit 026991d469
2 changed files with 4 additions and 16 deletions

View File

@ -31,7 +31,7 @@ const exp: Modul = {
if (verze == require("../../package.json").version) return `ale ja se nemam co priucit vole kkte ${mes.author}`;
}
getVoiceConnections().forEach(con => con.disconnect());
getVoiceConnections().forEach(con => con.destroy());
const client: Client = module.exports.client;
client.user?.setStatus("invisible");
mes.react("👋")
@ -62,7 +62,7 @@ const exp: Modul = {
} else if (!spim) {
if (cont == `${prefix} vypni se`) {
mes.react(emouty.purfieRIP);
getVoiceConnections().forEach(con => con.disconnect());
getVoiceConnections().forEach(con => con.destroy());
mes.client.user?.setStatus("invisible");
spim = true;
}

View File

@ -73,20 +73,8 @@ export async function joinVoice(channel: VoiceChannel | StageChannel | string, g
let conn = getVoiceConnection(guildId);
let prev: boolean | string = false;
if (conn) {
if (conn.joinConfig.channelId === channelId) {
await entersState(conn, VoiceConnectionStatus.Ready, 3e4)
.catch(err => {
conn!.destroy();
log("pri pripojovani do vojsu nastala chyba:");
throw err;
});
return { conn, prev: true };
}
prev = conn.joinConfig.channelId!;
if (!prev) {
log(new Error(`chci do kanelu "${channelId}", na serveru "${guildId}" a config channelid nen`));
throw new Error("Dement no");
}
if (conn.joinConfig.channelId == channelId) return { conn, prev: true };
prev = conn.joinConfig.channelId ?? false;
}
conn = joinVoiceChannel({