From 4ccd7940cfba7194fb4b3d221c0ed36cf007cd46 Mon Sep 17 00:00:00 2001 From: histmy Date: Mon, 22 Feb 2021 00:04:36 +0100 Subject: [PATCH] =?UTF-8?q?Better=20neodposlouch=C3=A1vej?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index cefe5c3..d4a42df 100644 --- a/app.js +++ b/app.js @@ -47,10 +47,12 @@ client.on('presenceUpdate', (bef, aft) => { client.on('voiceStateUpdate', (bef, aft) => { if (!aft.channel || !aft.guild.voice || aft.member.user === client.user) return; - if (!aft.guild.voice.connection) return; if (aft.mute && !aft.deaf) { - const disp = aft.guild.voice.connection.play('./zvuky/neodposlouchavej.ogg', { volume: 0.38 }); - disp.on('finish', () => aft.setDeaf(true, 'otposlouchávala ta gadza')); + if (!aft.guild.voice.connection) aft.setDeaf(true, 'otposlouchávala ta gadza'); + else { + aft.guild.voice.connection.play('./zvuky/neodposlouchavej.ogg', { volume: 0.38 }) + .on('finish', () => {if (aft.mute) aft.setDeaf(true, 'otposlouchávala ta gadza')}); + } } if (!bef.channel) return;