Fixed bot crashing after him leaving voice

and somebody odposlouchávat
This commit is contained in:
Histmy 2021-01-28 10:49:17 +01:00
parent 67cd0addc8
commit b48aa8d125

1
app.js
View File

@ -48,6 +48,7 @@ client.on('presenceUpdate', (bef, aft) => {
client.on('voiceStateUpdate', (bef, aft) => { client.on('voiceStateUpdate', (bef, aft) => {
if (!aft.channel || !aft.guild.voice || aft.member.user === client.user) return; if (!aft.channel || !aft.guild.voice || aft.member.user === client.user) return;
if (!aft.guild.voice.connection) return;
if (aft.mute && !aft.deaf) { if (aft.mute && !aft.deaf) {
const disp = aft.guild.voice.connection.play('./zvuky/neodposlouchavej.ogg'); const disp = aft.guild.voice.connection.play('./zvuky/neodposlouchavej.ogg');
disp.on('finish', () => aft.setDeaf(true, 'otposlouchávala ta gadza')); disp.on('finish', () => aft.setDeaf(true, 'otposlouchávala ta gadza'));