if vojs potichu, nazdar not played

This commit is contained in:
Histmy 2021-08-29 00:52:38 +02:00
parent e2b8ffe039
commit 2ad65d54ff

View File

@ -67,20 +67,21 @@ module.exports = {
const channel = mes.member?.voice.channel; const channel = mes.member?.voice.channel;
if (!channel) return `di si tam sam ne ty gadzo ${mes.author}`; if (!channel) return `di si tam sam ne ty gadzo ${mes.author}`;
if (arg !== "potichu") mes.channel.send("<@&591306633196339261> vojs"); const nahlas = arg !== "potichu";
if (nahlas) mes.channel.send("<@&591306633196339261> vojs");
joinVoice(channel) joinVoice(channel)
.then(obj => { .then(obj => {
const conn = obj.conn; const { prev, conn } = obj;
if (!timeouty[mes.guildId!]) { if (!timeouty[mes.guildId!]) {
vypocitatCas(conn); vypocitatCas(conn);
conn.on(VoiceConnectionStatus.Disconnected, () => conn.destroy()); conn.on("stateChange", (_, now) => {
conn.on(VoiceConnectionStatus.Destroyed, () => { if (now.status !== VoiceConnectionStatus.Disconnected && now.status !== VoiceConnectionStatus.Destroyed) return;
clearTimeout(timeouty[mes.guildId!]); clearTimeout(timeouty[mes.guildId!]);
delete timeouty[mes.guildId!]; delete timeouty[mes.guildId!];
}); });
} }
play(conn, "zvuky/nazdar.ogg"); if (prev !== true && nahlas) play(conn, "zvuky/nazdar.ogg");
}); });
} }
}, },