forked from embee/woomy
being force-disconnected from vc no longer breaks
This commit is contained in:
parent
98612a7784
commit
be16d511e2
2 changed files with 9 additions and 1 deletions
|
@ -29,7 +29,6 @@ exports.run = async (client, message) => {
|
|||
guild.queue = []
|
||||
guild.playing = false
|
||||
guild.paused = false
|
||||
guild.dispatcher = null
|
||||
guild.skippers = []
|
||||
|
||||
message.channel.send('Playback stopped!')
|
||||
|
|
|
@ -6,6 +6,15 @@ module.exports = (client, oldState, newState) => {
|
|||
if (newState.channelID !== oldState.channelID) {
|
||||
const guild = music.getGuild(newState.guild.id)
|
||||
|
||||
// Reset queue, dispatcher, etc if Woomy is forcibly disconnected from the queue
|
||||
if (!guild.voiceChannel.members.get(client.user.id) && guild.queue.length > 0) {
|
||||
guild.queue = []
|
||||
guild.playing = false
|
||||
guild.paused = false
|
||||
guild.skippers = []
|
||||
}
|
||||
|
||||
// Auto-disconnect feature
|
||||
if (guild.playing && guild.voiceChannel.id === oldState.channelID) {
|
||||
if (guild.voiceChannel.members.filter(member => !member.user.bot).size < 1) {
|
||||
guild.autoDisconnect = true
|
||||
|
|
Loading…
Reference in a new issue