forked from embee/woomy
a
This commit is contained in:
parent
5769195df9
commit
fb31e369f8
2 changed files with 18 additions and 17 deletions
|
@ -4,7 +4,7 @@ exports.conf = {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
aliases: [],
|
aliases: [],
|
||||||
permLevel: 'Moderator',
|
permLevel: 'User ',
|
||||||
requiredPerms: ['CONNECT', 'SPEAK'],
|
requiredPerms: ['CONNECT', 'SPEAK'],
|
||||||
cooldown: 10000
|
cooldown: 10000
|
||||||
}
|
}
|
||||||
|
@ -20,36 +20,36 @@ exports.help = {
|
||||||
const music = require('../utils/music')
|
const music = require('../utils/music')
|
||||||
exports.run = async (client, message, args, level, data) => {
|
exports.run = async (client, message, args, level, data) => {
|
||||||
// get guild music data
|
// get guild music data
|
||||||
const mGuild = music.getGuild(message.guild.id)
|
const guild = music.getGuild(message.guild.id)
|
||||||
|
|
||||||
if (!mGuild.playing) {
|
if (!guild.playing) {
|
||||||
return message.channel.send('<:error:466995152976871434> Nothing is playing.')
|
return message.channel.send('<:error:466995152976871434> Nothing is playing.')
|
||||||
}
|
}
|
||||||
|
|
||||||
// change text channel
|
|
||||||
let textChannelChanged = false
|
let textChannelChanged = false
|
||||||
|
let voiceChannelChanged = false
|
||||||
|
|
||||||
if (mGuild.channel.id !== message.channel.id) {
|
// change text channel
|
||||||
mGuild.channel = message.channel
|
if (guild.channel.id !== message.channel.id) {
|
||||||
|
guild.channel = message.channel
|
||||||
|
|
||||||
textChannelChanged = true
|
textChannelChanged = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// move to another voice channel
|
// move to another voice channel
|
||||||
let voiceChannelMoved = false
|
if (message.member.voice.channel && guild.voiceChannel && (message.member.voice.channel !== guild.voiceChannel.id)) {
|
||||||
|
guild.voiceChannel.leave()
|
||||||
if (message.voice.channel && mGuild.voiceChannel && (message.voice.channel !== mGuild.voiceChannel.id)) {
|
guild.voiceChannel = message.member.voice.channel
|
||||||
// TODO: this
|
guild.voiceChannel.join()
|
||||||
|
voiceChannelChanged = true
|
||||||
voiceChannelMoved = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// response
|
// response
|
||||||
if (textChannelChanged && voiceChannelMoved) {
|
if (textChannelChanged && voiceChannelChanged) {
|
||||||
return message.channel.send('<:success:466995111885144095> Music playback moved to your voice channel and music messages to your text channel.')
|
return message.channel.send('<:success:466995111885144095> Music playback moved to your voice channel and music messages to your text channel.')
|
||||||
} else if (textChannelChanged) {
|
} else if (textChannelChanged) {
|
||||||
return message.channel.send('<:success:466995111885144095> Music module will send messages to your text channel.')
|
return message.channel.send('<:success:466995111885144095> Music module will send messages to your text channel.')
|
||||||
} else if (voiceChannelMoved) {
|
} else if (voiceChannelChanged) {
|
||||||
return message.channel.send('<:success:466995111885144095> Music playback moved to your voice channel.')
|
return message.channel.send('<:success:466995111885144095> Music playback moved to your voice channel.')
|
||||||
} else {
|
} else {
|
||||||
return message.channel.send('<:error:466995152976871434> Music is already playing in your voice channel!')
|
return message.channel.send('<:error:466995152976871434> Music is already playing in your voice channel!')
|
||||||
|
|
|
@ -6,16 +6,17 @@ module.exports = (client, oldState, newState) => {
|
||||||
if (newState.channelID !== oldState.channelID) {
|
if (newState.channelID !== oldState.channelID) {
|
||||||
const guild = music.getGuild(newState.guild.id)
|
const guild = music.getGuild(newState.guild.id)
|
||||||
|
|
||||||
// Reset queue, dispatcher, etc if Woomy is forcibly disconnected from the queue
|
/* Reset queue, dispatcher, etc if Woomy is forcibly disconnected from the queue
|
||||||
if (!guild.voiceChannel.members.get(client.user.id) && guild.queue.length > 0) {
|
if (guild.voiceChannel && !guild.voiceChannel.members.get(client.user.id) && guild.queue.length > 0) {
|
||||||
guild.queue = []
|
guild.queue = []
|
||||||
guild.playing = false
|
guild.playing = false
|
||||||
guild.paused = false
|
guild.paused = false
|
||||||
guild.skippers = []
|
guild.skippers = []
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Auto-disconnect feature
|
// Auto-disconnect feature
|
||||||
if (guild.playing && guild.voiceChannel.id === oldState.channelID) {
|
if (guild.playing && guild.Channel && guild.voiceChannel.id === oldState.channelID) {
|
||||||
if (guild.voiceChannel.members.filter(member => !member.user.bot).size < 1) {
|
if (guild.voiceChannel.members.filter(member => !member.user.bot).size < 1) {
|
||||||
guild.autoDisconnect = true
|
guild.autoDisconnect = true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue