diff --git a/src/modules/zbytek.ts b/src/modules/zbytek.ts index 5c51704..7f01427 100644 --- a/src/modules/zbytek.ts +++ b/src/modules/zbytek.ts @@ -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; } diff --git a/src/utils/utils.ts b/src/utils/utils.ts index ebcb8c9..2f416f1 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -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({