<commit_before>/**
 * @file disconnect command
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license GPL-3.0
 */

exports.exec = async (Bastion, message) => {
  if (message.guild.music) {
    message.guild.music.songs = [];

    if (message.guild.music.dispatcher) {
      message.guild.music.dispatcher.end();
    }
  }

  if (message.guild.voiceConnection) {
    message.guild.voiceConnection.disconnect();
  }

  await message.channel.send({
    embed: {
      color: Bastion.colors.RED,
      description: 'Disconnected from the voice connection of this server.'
    }
  }).catch(e => {
    Bastion.log.error(e);
  });
};

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

exports.help = {
  name: 'disconnect',
  description: 'Disconnect Bastion from any voice connection in the Discord server.',
  botPermission: '',
  userTextPermission: '',
  userVoicePermission: '',
  usage: 'disconnect',
  example: []
};
<commit_msg>commands(music): improvements to disconnect command<commit_after>/**
 * @file disconnect command
 * @author <NAME> (a.k.a k3rn31p4nic)
 * @license GPL-3.0
 */

exports.exec = async (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);
  }

  message.guild.music.songs = [];

  if (message.guild.music.dispatcher) {
    message.guild.music.dispatcher.end();
  }

  if (message.guild.voiceConnection) {
    message.guild.voiceConnection.disconnect();
  }

  await message.channel.send({
    embed: {
      color: Bastion.colors.RED,
      description: 'Disconnected from the voice connection of this server.'
    }
  }).catch(e => {
    Bastion.log.error(e);
  });
};

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

exports.help = {
  name: 'disconnect',
  description: 'Disconnect Bastion from any voice connection in the Discord server.',
  botPermission: '',
  userTextPermission: '',
  userVoicePermission: '',
  usage: 'disconnect',
  example: []
};

{'fraction_non_alphanumeric': 0.15597147950089127, 'fraction_numerical': 0.015151515151515152, 'mean_word_length': 3.5537525354969572, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '4501016', 'n_tokens_mistral': 780, 'n_tokens_neox': 744, 'n_words': 147}