mirror of
https://github.com/musix-org/musix-oss
synced 2024-11-10 08:10:18 +00:00
Update voiceStateUpdate.js
This commit is contained in:
parent
dc35e730a7
commit
1e26e3bb95
@ -4,18 +4,14 @@ module.exports = {
|
|||||||
let change = false;
|
let change = false;
|
||||||
const serverQueue = client.queue.get(newState.guild.id);
|
const serverQueue = client.queue.get(newState.guild.id);
|
||||||
if (!serverQueue) return;
|
if (!serverQueue) return;
|
||||||
console.log('vocestate')
|
|
||||||
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
|
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
|
||||||
console.log('cocecece')
|
|
||||||
if (newState.member.voice.channel === null) {
|
if (newState.member.voice.channel === null) {
|
||||||
console.log('discoennect')
|
|
||||||
serverQueue.songs = [];
|
serverQueue.songs = [];
|
||||||
serverQueue.looping = false;
|
serverQueue.looping = false;
|
||||||
serverQueue.endReason = "manual disconnect";
|
serverQueue.endReason = "manual disconnect";
|
||||||
return client.queue.delete(newState.guild.id);
|
return client.queue.delete(newState.guild.id);
|
||||||
}
|
}
|
||||||
if (newState.member.voice.channel !== serverQueue.voiceChannel) {
|
if (newState.member.voice.channel !== serverQueue.voiceChannel) {
|
||||||
console.log('wrong channe')
|
|
||||||
change = true;
|
change = true;
|
||||||
serverQueue.voiceChannel = newState.member.voice.channel;
|
serverQueue.voiceChannel = newState.member.voice.channel;
|
||||||
serverQueue.connection = newState.connection;
|
serverQueue.connection = newState.connection;
|
||||||
@ -23,12 +19,9 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
if (oldState.channel === null) return;
|
if (oldState.channel === null) return;
|
||||||
if (oldState.channel.members.size === 1 && oldState.channel === serverQueue.voiceChannel || change) {
|
if (oldState.channel.members.size === 1 && oldState.channel === serverQueue.voiceChannel || change) {
|
||||||
console.log('left alone')
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
console.log('timeout')
|
|
||||||
if (!serverQueue) return;
|
if (!serverQueue) return;
|
||||||
if (serverQueue.voiceChannel.members.size === 1) {
|
if (serverQueue.voiceChannel.members.size === 1) {
|
||||||
console.log('still alone')
|
|
||||||
serverQueue.songs = [];
|
serverQueue.songs = [];
|
||||||
serverQueue.looping = false;
|
serverQueue.looping = false;
|
||||||
serverQueue.endReason = "Timeout";
|
serverQueue.endReason = "Timeout";
|
||||||
|
Loading…
Reference in New Issue
Block a user