did stuff but voteskip is broken (line 51)
This commit is contained in:
		
							parent
							
								
									39fa428614
								
							
						
					
					
						commit
						cb26ce0989
					
				
					 2 changed files with 70 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -10,16 +10,16 @@ exports.conf = {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
exports.help = {
 | 
			
		||||
  name: 'forceskip',
 | 
			
		||||
  name: 'skip',
 | 
			
		||||
  category: 'Music',
 | 
			
		||||
  description: 'Force skips currently playing song.',
 | 
			
		||||
  usage: 'forceskip',
 | 
			
		||||
  usage: 'skip',
 | 
			
		||||
  params: ''
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const { skip } = require('../utils/music')
 | 
			
		||||
exports.run = async (client, message, args, level, data) => {
 | 
			
		||||
  skip(message.guild, 'forceskip')
 | 
			
		||||
  skip(message.guild, 'skip')
 | 
			
		||||
 | 
			
		||||
  message.reply('skipped currently playing music')
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										67
									
								
								commands/voteskip.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								commands/voteskip.js
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,67 @@
 | 
			
		|||
// Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license.
 | 
			
		||||
 | 
			
		||||
exports.conf = {
 | 
			
		||||
  enabled: true,
 | 
			
		||||
  guildOnly: true,
 | 
			
		||||
  aliases: [],
 | 
			
		||||
  permLevel: 'User',
 | 
			
		||||
  requiredPerms: [],
 | 
			
		||||
  cooldown: 2000
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.help = {
 | 
			
		||||
  name: 'voteskip',
 | 
			
		||||
  category: 'Music',
 | 
			
		||||
  description: 'Vote to skip the currently playing song.',
 | 
			
		||||
  usage: 'voteskip',
 | 
			
		||||
  params: ''
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const { skip, getGuild } = require('../utils/music')
 | 
			
		||||
exports.run = (client, message, args, level) => {
 | 
			
		||||
  const guild = getGuild(message.guild.id)
 | 
			
		||||
 | 
			
		||||
  if (guild.queue.length < 1 || !guild.playing || !guild.dispatcher) {
 | 
			
		||||
    return message.channel.send(
 | 
			
		||||
      '<:error:466995152976871434> Nothing is playing.'
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const vc = message.guild.members.cache.get(client.user.id).voiceChannel
 | 
			
		||||
 | 
			
		||||
  if (vc !== message.member.voiceChannel) {
 | 
			
		||||
    return message.channel.send(
 | 
			
		||||
      '<:error:466995152976871434> You need to be in my voice channel to use this command!'
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (guild.queue[0].requestedBy.id === message.author.id) {
 | 
			
		||||
    skip(message.guild, 'skip')
 | 
			
		||||
 | 
			
		||||
    message.channel.send(
 | 
			
		||||
      '<:skip:467216735356059660> Song has been skipped by the user who requested it.'
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
    return
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (guild.skippers.indexOf(message.author.id) === -1) {
 | 
			
		||||
    guild.skippers.push(message.author.id)
 | 
			
		||||
 | 
			
		||||
    if (guild.skippers.length >= Math.ceil(vc.members.filter(member => !member.user.bot).size / 2)) {
 | 
			
		||||
      skip(message.guild, 'skip')
 | 
			
		||||
 | 
			
		||||
      message.channel.send(
 | 
			
		||||
        '<:skip:467216735356059660> Song has been skipped.'
 | 
			
		||||
      )
 | 
			
		||||
    } else {
 | 
			
		||||
      message.channel.send(
 | 
			
		||||
        `<:success:466995111885144095> Your vote has been acknowledged! **${guild.skippers.length + '/' + Math.ceil(vc.members.filter(member => !member.user.bot).size / 2)}**`
 | 
			
		||||
      )
 | 
			
		||||
    };
 | 
			
		||||
  } else {
 | 
			
		||||
    message.channel.send(
 | 
			
		||||
      '<:denied:466995195150336020> You cannot vote twice!'
 | 
			
		||||
    )
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue