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,
 | 
			
		||||
  guildOnly: true,
 | 
			
		||||
  aliases: [],
 | 
			
		||||
  permLevel: 'Moderator',
 | 
			
		||||
  permLevel: 'User  ',
 | 
			
		||||
  requiredPerms: ['CONNECT', 'SPEAK'],
 | 
			
		||||
  cooldown: 10000
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -20,36 +20,36 @@ exports.help = {
 | 
			
		|||
const music = require('../utils/music')
 | 
			
		||||
exports.run = async (client, message, args, level, 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.')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // change text channel
 | 
			
		||||
  let textChannelChanged = false
 | 
			
		||||
  let voiceChannelChanged = false
 | 
			
		||||
 | 
			
		||||
  if (mGuild.channel.id !== message.channel.id) {
 | 
			
		||||
    mGuild.channel = message.channel
 | 
			
		||||
  // change text channel
 | 
			
		||||
  if (guild.channel.id !== message.channel.id) {
 | 
			
		||||
    guild.channel = message.channel
 | 
			
		||||
 | 
			
		||||
    textChannelChanged = true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // move to another voice channel
 | 
			
		||||
  let voiceChannelMoved = false
 | 
			
		||||
 | 
			
		||||
  if (message.voice.channel && mGuild.voiceChannel && (message.voice.channel !== mGuild.voiceChannel.id)) {
 | 
			
		||||
    // TODO: this
 | 
			
		||||
 | 
			
		||||
    voiceChannelMoved = true
 | 
			
		||||
  if (message.member.voice.channel && guild.voiceChannel && (message.member.voice.channel !== guild.voiceChannel.id)) {
 | 
			
		||||
    guild.voiceChannel.leave()
 | 
			
		||||
    guild.voiceChannel = message.member.voice.channel
 | 
			
		||||
    guild.voiceChannel.join()
 | 
			
		||||
    voiceChannelChanged = true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // 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.')
 | 
			
		||||
  } else if (textChannelChanged) {
 | 
			
		||||
    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.')
 | 
			
		||||
  } else {
 | 
			
		||||
    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) {
 | 
			
		||||
    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) {
 | 
			
		||||
    /* Reset queue, dispatcher, etc if Woomy is forcibly disconnected from the queue
 | 
			
		||||
    if (guild.voiceChannel && !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.playing && guild.Channel && guild.voiceChannel.id === oldState.channelID) {
 | 
			
		||||
      if (guild.voiceChannel.members.filter(member => !member.user.bot).size < 1) {
 | 
			
		||||
        guild.autoDisconnect = true
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue