forked from embee/woomy
		
	begin polishing up music modules
This commit is contained in:
		
							parent
							
								
									caeeafa3bb
								
							
						
					
					
						commit
						a31dc02568
					
				
					 2 changed files with 13 additions and 42 deletions
				
			
		| 
						 | 
				
			
			@ -6,13 +6,13 @@ exports.conf = {
 | 
			
		|||
  aliases: [],
 | 
			
		||||
  permLevel: 'User',
 | 
			
		||||
  requiredPerms: ['CONNECT', 'SPEAK'],
 | 
			
		||||
  cooldown: 10000
 | 
			
		||||
  cooldown: 2000
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.help = {
 | 
			
		||||
  name: 'movehere',
 | 
			
		||||
  category: 'Music',
 | 
			
		||||
  description: 'Moves the bot into your voice channel and/or text channel.',
 | 
			
		||||
  description: 'Moves music related messages to the channel the this command is ran in.',
 | 
			
		||||
  usage: 'movehere',
 | 
			
		||||
  parameters: ''
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -26,32 +26,11 @@ exports.run = async (client, message, args, level, data) => {
 | 
			
		|||
    return message.channel.send('<:error:466995152976871434> Nothing is playing.')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  let textChannelChanged = false
 | 
			
		||||
  let voiceChannelChanged = false
 | 
			
		||||
  if (guild.channel.id === message.channel.id) {
 | 
			
		||||
    return message.channel.send('<:error:466995152976871434> Music messages are already being sent to this channel.')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // change text channel
 | 
			
		||||
  if (guild.channel.id !== message.channel.id) {
 | 
			
		||||
  guild.channel = message.channel
 | 
			
		||||
 | 
			
		||||
    textChannelChanged = true
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // move to another voice channel
 | 
			
		||||
  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 && 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 (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!')
 | 
			
		||||
  }
 | 
			
		||||
  message.channel.send('<:success:466995111885144095> Music messages will now be sent to this channel.')
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,27 +37,19 @@ module.exports.run = (client, message, args, level) => {
 | 
			
		|||
  const newPosition = +args[1]
 | 
			
		||||
 | 
			
		||||
  if (isNaN(oldPosition) === true) {
 | 
			
		||||
    return message.channel.send('That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)')
 | 
			
		||||
    return message.channel.send('<:error:466995152976871434> That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (isNaN(newPosition) === true) {
 | 
			
		||||
    return message.channel.send('That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)')
 | 
			
		||||
    return message.channel.send('<:error:466995152976871434> That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (oldPosition < 1) {
 | 
			
		||||
    return message.channel.send('This number is too low!')
 | 
			
		||||
  if (oldPosition < 1 || oldPosition >= queue.length) {
 | 
			
		||||
    return message.channel.send('<:error:466995152976871434> Invalid song ID.')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (newPosition < 1) {
 | 
			
		||||
    return message.channel.send('This number is too low!')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (oldPosition >= queue.length) {
 | 
			
		||||
    return message.channel.send('This number is too high!')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (newPosition >= queue.length) {
 | 
			
		||||
    return message.channel.send('This number is too high!')
 | 
			
		||||
  if (newPosition < 1 || newPosition >= queue.length) {
 | 
			
		||||
    return message.channel.send('<:error:466995152976871434> Invalid song ID.')
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const songName = queue[oldPosition].video.title
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue