forked from embee/woomy
fixed formatting
This commit is contained in:
parent
13254e47ac
commit
7c10c5309f
1 changed files with 32 additions and 32 deletions
|
@ -1,40 +1,40 @@
|
||||||
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
|
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
|
||||||
|
|
||||||
const music = require('../utils/music');
|
const music = require('../utils/music')
|
||||||
|
|
||||||
module.exports = (client, oldState, newState) => {
|
module.exports = (client, oldState, newState) => {
|
||||||
if(newState.channelID != oldState.channelID) {
|
if (newState.channelID !== oldState.channelID) {
|
||||||
let guild = music.getGuild(newState.guild.id);
|
const guild = music.getGuild(newState.guild.id)
|
||||||
|
|
||||||
if(guild.playing && guild.voiceChannel.id == oldState.channelID) {
|
if (guild.playing && guild.voiceChannel.id === oldState.channelID) {
|
||||||
if(guild.voiceChannel.members.size == 1) {
|
if (guild.voiceChannel.members.size === 1) {
|
||||||
guild.autoDisconnect = true;
|
guild.autoDisconnect = true
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if(guild.voiceChannel.members.size == 1 && guild.autoDisconnect) {
|
if (guild.voiceChannel.members.size === 1 && guild.autoDisconnect) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if(guild.voiceChannel.members.size == 1 && guild.autoDisconnect) {
|
if (guild.voiceChannel.members.size === 1 && guild.autoDisconnect) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if(guild.voiceChannel.members.size == 1 && guild.autoDisconnect) {
|
if (guild.voiceChannel.members.size === 1 && guild.autoDisconnect) {
|
||||||
guild.playing = false;
|
guild.playing = false
|
||||||
guild.queue = [];
|
guild.queue = []
|
||||||
|
|
||||||
// Probably should be async? But no need here I think
|
// Probably should be async? But no need here I think
|
||||||
guild.dispatcher.end('silent');
|
guild.dispatcher.end('silent')
|
||||||
guild.message.channel.send('No one is listening to me. Leaving voice chat!');
|
guild.message.channel.send('No one is listening to me. Leaving voice chat!')
|
||||||
} else {
|
} else {
|
||||||
guild.autoDisconnect = false;
|
guild.autoDisconnect = false
|
||||||
};
|
}
|
||||||
}, 30000);
|
}, 30000)
|
||||||
} else {
|
} else {
|
||||||
guild.autoDisconnect = false;
|
guild.autoDisconnect = false
|
||||||
};
|
}
|
||||||
}, 20000);
|
}, 20000)
|
||||||
} else {
|
} else {
|
||||||
guild.autoDisconnect = false;
|
guild.autoDisconnect = false
|
||||||
};
|
}
|
||||||
}, 10000);
|
}, 10000)
|
||||||
};
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue