<commit_before>const logger = require('winston')
const { Command } = require('../../core')

class Skip extends Command {
  constructor (...args) {
    super(...args, {
      name: 'skip',
      description: 'Skips the current music track',
      cooldown: 5,
      options: { guildOnly: true, localeKey: 'music' },
      usage: [{ name: 'id', type: 'int', optional: true, min: 1 }]
    })
  }

  async handle ({ msg, settings, client, modules, args }, responder) {
    const music = modules.get('music')
    if (!music) return
    const conn = music.getConnection(msg.channel)
    if (!conn) {
      return responder.error('{{errors.notInChannel}}', {
        command: `**\`${settings.prefix}summon\`**`
      })
    }
    if (msg.member.voiceState.channelID !== conn.channelID) {
      return responder.error('{{errors.notInSameVoice}}', {
        channel: `'**${client.getChannel(conn.channelID).name}**'`
      })
    }
    const chan = music.getBoundChannel(msg.channel.guild.id)
    if (chan && chan !== msg.channel.id) {
      return responder.error('{{errors.notChannel}}', {
        channel: client.getChannel(chan).mention,
        deleteDelay: 5000
      })
    }
    if (args.id) {
      try {
        const video = await music.queue.remove(msg.channel.guild.id, args.id - 1)
        if (!video) {
          return responder.error('{{errors.skipNotFound}}')
        }
        return responder.success('{{skipSuccess}}', { song: `**${video.title}**` })
      } catch (err) {
        logger.error(`Error skipping video ${args.id - 1} for ${msg.channel.guild.name} (${msg.channel.guild.name})`)
        logger.error(err)
        return responder.error()
      }
    }
    const voiceChannel = client.getChannel(conn.channelID)
    return music.skip(msg.channel.guild.id, voiceChannel, msg.author.id)
    .then(res => {
      if (typeof res === 'string') return responder.success(`{{${res}}}`)
    })
  }
}

module.exports = Skip<commit_msg>:sparkles: Allow admins to bypass skip<commit_after>const logger = require('winston')
const { Command } = require('../../core')

class Skip extends Command {
  constructor (...args) {
    super(...args, {
      name: 'skip',
      description: 'Skips the current music track',
      cooldown: 5,
      options: { guildOnly: true, localeKey: 'music' },
      usage: [{ name: 'id', type: 'int', optional: true, min: 1 }]
    })
  }

  async handle ({ msg, settings, client, modules, args }, responder) {
    const music = modules.get('music')
    if (!music) return
    const conn = music.getConnection(msg.channel)
    if (!conn) {
      return responder.error('{{errors.notInChannel}}', {
        command: `**\`${settings.prefix}summon\`**`
      })
    }
    if (msg.member.voiceState.channelID !== conn.channelID) {
      return responder.error('{{errors.notInSameVoice}}', {
        channel: `'**${client.getChannel(conn.channelID).name}**'`
      })
    }
    const chan = music.getBoundChannel(msg.channel.guild.id)
    if (chan && chan !== msg.channel.id) {
      return responder.error('{{errors.notChannel}}', {
        channel: client.getChannel(chan).mention,
        deleteDelay: 5000
      })
    }
    if (args.id) {
      try {
        const video = await music.queue.remove(msg.channel.guild.id, args.id - 1)
        if (!video) {
          return responder.error('{{errors.skipNotFound}}')
        }
        return responder.success('{{skipSuccess}}', { song: `**${video.title}**` })
      } catch (err) {
        logger.error(`Error skipping video ${args.id - 1} for ${msg.channel.guild.name} (${msg.channel.guild.name})`)
        logger.error(err)
        return responder.error()
      }
    }
    const voiceChannel = client.getChannel(conn.channelID)
    return music.skip(msg.channel.guild.id, voiceChannel, msg.author.id, msg.member.permission.has('manageGuild'))
    .then(res => {
      if (typeof res === 'string') return responder.success(`{{${res}}}`)
    })
  }
}

module.exports = Skip
{'fraction_non_alphanumeric': 0.17562452687358063, 'fraction_numerical': 0.0040373454453696694, 'mean_word_length': 2.7466918714555764, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5294422', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1244, 'n_words': 257}