From be228e004893d3ff1c0d01364b03a82d80538ed8 Mon Sep 17 00:00:00 2001 From: Histmy <59661489+Histmy@users.noreply.github.com> Date: Thu, 24 Aug 2023 20:08:51 +0200 Subject: [PATCH] =?UTF-8?q?kvalitn=C3=AD=20patch=20na=20nekvalitn=C3=AD=20?= =?UTF-8?q?chybu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 4 ++-- package.json | 2 +- src/modules/vyhledavac.ts | 3 ++- src/modules/zapniVypniSe.ts | 3 ++- src/utils/voice.ts | 4 +++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index cffbd83..7ecf887 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "denim_3001", - "version": "3001.53.0", + "version": "3001.53.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "denim_3001", - "version": "3001.53.0", + "version": "3001.53.1", "license": "ISC", "dependencies": { "@discordjs/voice": "^0.16.0", diff --git a/package.json b/package.json index 8b67f9a..1bb19d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "denim_3001", - "version": "3001.53.0", + "version": "3001.53.1", "description": "Toto je velmi kvalitní bot.", "repository": { "url": "https://github.com/Histmy/Denim-Bot/" diff --git a/src/modules/vyhledavac.ts b/src/modules/vyhledavac.ts index a351efc..2389040 100644 --- a/src/modules/vyhledavac.ts +++ b/src/modules/vyhledavac.ts @@ -1,7 +1,7 @@ import { APIEmbed, CommandInteractionOption, Message, TextBasedChannel } from "discord.js"; import { CClient, Modul } from "../utils/types"; import { createPool } from "mysql"; -import { strankovani } from "../utils/utils"; +import { log, strankovani } from "../utils/utils"; // Připojení do databáze const pool = createPool({ @@ -147,6 +147,7 @@ const exp: Modul = { try { await zpracovatZpravu(mes); } catch { + log("general sync kompletni"); return; } } diff --git a/src/modules/zapniVypniSe.ts b/src/modules/zapniVypniSe.ts index 00d3eaa..776e5a1 100644 --- a/src/modules/zapniVypniSe.ts +++ b/src/modules/zapniVypniSe.ts @@ -3,6 +3,7 @@ import { Message } from "discord.js"; import { emouty } from "../utils/emotes"; import { Modul } from "../utils/types"; import { prefix } from "../utils/utils"; +import { novejLeave } from "../utils/voice"; let spim = false; @@ -21,7 +22,7 @@ const exp: Modul = { } else if (!spim) { if (cont == `${prefix} vypni se`) { mes.react(emouty.purfieRIP); - getVoiceConnections().forEach(con => con.destroy()); + getVoiceConnections().forEach(con => novejLeave(con.joinConfig.guildId)); mes.client.user?.setStatus("invisible"); spim = true; } diff --git a/src/utils/voice.ts b/src/utils/voice.ts index b5a1d2c..ef2209c 100644 --- a/src/utils/voice.ts +++ b/src/utils/voice.ts @@ -113,7 +113,9 @@ export function novejLeave(guildId: string) { clearTimeout(timeouty.get(guildId)); timeouty.delete(guildId); - vojs.conn.destroy(); + if (vojs.conn.state.status != VoiceConnectionStatus.Destroyed) + vojs.conn.destroy(); + vojsy.delete(guildId); return true;