diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e2a43a7..219ad3b 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -41,7 +41,7 @@ services: volumes: - mysql_data:/var/lib/mysql healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-remix_root_pw}"] + test: ["CMD-SHELL", "MYSQL_PWD=${MYSQL_ROOT_PASSWORD:-remix_root_pw} mysqladmin ping -h 127.0.0.1 -u root"] interval: 10s timeout: 5s retries: 10 @@ -87,4 +87,4 @@ volumes: networks: remix-net: - driver: bridge + driver: bridge \ No newline at end of file diff --git a/src/music/player/Player.mjs b/src/music/player/Player.mjs index 7b69e0d..6c95e7f 100644 --- a/src/music/player/Player.mjs +++ b/src/music/player/Player.mjs @@ -560,7 +560,8 @@ class Player extends EventEmitter { const check = () => { try { if (voiceConn.isConnected()) { clearTimeout(timeout); return resolve(); } - if (voiceConn.connectionState === 0) { clearTimeout(timeout); return resolve(); } + const cs = voiceConn.connectionState; + if (cs === 2 || cs === "connected" || cs === "CONN_CONNECTED") { clearTimeout(timeout); return resolve(); } } catch (_) { clearTimeout(timeout); return resolve(); } setTimeout(check, 200); }; diff --git a/src/utils/Helpers247.mjs b/src/utils/Helpers247.mjs index 0874171..5f5880a 100644 --- a/src/utils/Helpers247.mjs +++ b/src/utils/Helpers247.mjs @@ -25,14 +25,18 @@ export function isPlayerConnectionDead(player) { const conn = player._voiceConn ?? player.connection ?? null; if (!conn) return true; - const room = conn.room ?? null; - if (!room) { - try { return conn.isConnected?.() === false; } catch (_) { return false; } + if (typeof conn.isConnected === "function") { + try { + if (!conn.isConnected()) return true; + } catch (_) {} } - if (room.isConnected === false) return true; - const cs = room.connectionState; - if (cs === 0 || cs === "CONN_DISCONNECTED") return true; + const room = conn.room ?? null; + if (room) { + if (room.isConnected === false || room.isClosed === true) return true; + const cs = (room.state ?? room.connectionState ?? "").toString().toLowerCase(); + if (cs === "disconnected" || cs === "0" || cs === "conn_disconnected") return true; + } return false; }