/**
 * @file repeat command
 * @author Sankarsan Kampa (a.k.a k3rn31p4nic)
 * @license GPL-3.0
 */

exports.exec = (Bastion, message) => {
  if (!message.guild.music.enabled) {
    if (Bastion.user.id === '267035345537728512') {
      return Bastion.emit('error', '', Bastion.i18n.error(message.guild.language, 'musicDisabledPublic'), message.channel);
    }
    return Bastion.emit('error', '', Bastion.i18n.error(message.guild.language, 'musicDisabled'), message.channel);
  }

  if (message.guild.music.textChannelID && message.channel.id !== message.guild.music.textChannelID) return Bastion.log.info('Music channels have been set, so music commands will only work in the music text channel.');

  if (!message.guild.music.songs || !message.guild.music.songs.length) {
    /**
     * Error condition is encountered.
     * @fires error
     */
    return Bastion.emit('error', '', Bastion.i18n.error(message.guild.language, 'notPlaying'), message.channel);
  }

  let color, repeatStat = '';
  if (message.guild.music.repeat) {
    color = Bastion.colors.RED;
    message.guild.music.repeat = false;
    repeatStat = 'Removed the current song from repeat queue.';
  }
  else {
    color = Bastion.colors.GREEN;
    message.guild.music.repeat = true;
    repeatStat = Bastion.i18n.info(message.guild.language, 'repeatSong', message.author.tag);
  }

  message.guild.music.textChannel.send({
    embed: {
      color: color,
      description: repeatStat
    }
  }).catch(e => {
    Bastion.log.error(e);
  });
};

exports.config = {
  aliases: [ 'loop' ],
  enabled: true
};

exports.help = {
  name: 'repeat',
  botPermission: '',
  userTextPermission: '',
  userVoicePermission: '',
  usage: 'repeat',
  example: []
};

@@ -528,18 +528,33 @@
 age.
-c
+guild.music.textC
 hannel
-.id
+ID
  !==
@@ -566,34 +566,25 @@
 age.
-guild.music.textChannelID)
+channel.id) %7B%0A   
  ret
@@ -679,20 +679,20 @@
 the 
-m
+M
 usic 
-t
+T
 ext 
-c
+C
 hann
@@ -697,16 +697,20 @@
 nnel.');
+%0A  %7D
 %0A%0A  if (
@@ -780,83 +780,8 @@
 ) %7B%0A
-    /**%0A     * Error condition is encountered.%0A     * @fires error%0A     */%0A
     

refactor repeat command