<commit_before>module.exports.name = 'voiceMute';
module.exports.alias = [
  'voicemute',
  'vm'
];

const Discord = require('discord.js');
const Util = require('../classes/Util.js');

module.exports.isAllowed = (message, server) => {
  if (server.guild.id != '189571157446492161') return false; // Only in EJLX
  return message.member.hasPermission('MUTE_MEMBERS');
};

module.exports.help = '__VW Only__ Voice mutes people. `,vm <@mentions> [reason]`';

module.exports.command = async (message, content, bot, server) => {
  let targets = message.mentions.members;
  if (targets.size === 0) {
    message.channel.send('You must mention them');
    return;
  }
  let reason = content.replace(Util.REGEX_USER, '').trim();
  if (reason == ''){
    reason = 'unspecified';
  }
  const ewbf = server.guild.channels.get('277384105245802497');
  for (let [ , member] of targets) {
    if (member.voice) {
      await member.voice.setMute(true, `by ${message.author.tag} Reason: ${reason}` );
    }
    
    await member.addRole('357687893566947329'); // Voice mute role
    let embed = new Discord.RichEmbed();
    embed.title = `You have been voice muted in the English-Japanese Language Exchange server by ${message.author.tag}`;
    embed.description = `Reason: ${reason}`;
    embed.color = Number('0xEC891D');
    embed.setFooter('Contact one of the mods if you need to discuss this issue.', message.author.avatarURL);
    embed.timestamp = new Date();
    await member.send({embed});
    embed = new Discord.RichEmbed();
    embed.setAuthor(`${member.user.tag} has been muted in voice chat` , member.user.avatarURL);
    embed.description = `Reason: ${reason}`;
    embed.color = Number('0xEC891D');
    embed.setFooter(`by ${message.author.tag}`, message.author.avatarURL);
    embed.timestamp = new Date();
    ewbf.send({embed});
    const warning = {
      issued: message.createdTimestamp,
      issuer: message.author.id,
      link: message.url,
      warnMessage: `Voice muted`
    }
    if (server.warnlist[member.id]) {
      server.warnlist[member.id].push(
        warning
      )
    } else {
      server.warnlist[member.id] = [
        warning
      ];
    }
  }
  message.channel.send('✅ Voice Muted');
};<commit_msg>voicemute fix<commit_after>module.exports.name = 'voiceMute';
module.exports.alias = [
  'voicemute',
  'vm'
];

const Discord = require('discord.js');
const Util = require('../classes/Util.js');

module.exports.isAllowed = (message, server) => {
  if (server.guild.id != '189571157446492161') return false; // Only in EJLX
  return message.member.hasPermission('MUTE_MEMBERS');
};

module.exports.help = '__VW Only__ Voice mutes people. `,vm <@mentions> [reason]`';

module.exports.command = async (message, content, bot, server) => {
  content = content.replace(Util.REGEX_USER, '').trim();
  const targets = [...message.mentions.members.values()];
  const ids = content.match(Util.REGEX_RAW_ID);
  if (ids) {
    for (const id of ids) {
      const mem = server.guild.member(id);
      if (mem) {
        targets.push(mem);
      }
    }
    content = content.replace(Util.REGEX_RAW_ID, '').trim();
  }
  
  if (targets.size === 0) {
    message.channel.send('You must mention them');
    return;
  }
  let reason = content;
  if (!reason){
    reason = 'unspecified';
  }
  const ewbf = server.guild.channels.get('277384105245802497');
  for (const member of targets) {
    if (member.voiceChannel) {
      await member.setVoiceChannel(null);
    }
    await member.addRole('357687893566947329'); // Voice mute role
    let embed = new Discord.RichEmbed();
    embed.title = `You have been voice muted in the English-Japanese Language Exchange server by ${message.author.tag}`;
    embed.description = `Reason: ${reason}`;
    embed.color = Number('0xEC891D');
    embed.setFooter('Contact one of the mods if you need to discuss this issue.', message.author.avatarURL);
    embed.timestamp = new Date();
    await member.send({embed});
    embed = new Discord.RichEmbed();
    embed.setAuthor(`${member.user.tag} has been muted in voice chat` , member.user.avatarURL);
    embed.description = `Reason: ${reason}`;
    embed.color = Number('0xEC891D');
    embed.setFooter(`by ${message.author.tag}`, message.author.avatarURL);
    embed.timestamp = new Date();
    ewbf.send({embed});
    const warning = {
      issued: message.createdTimestamp,
      issuer: message.author.id,
      link: message.url,
      warnMessage: 'Voice muted'
    };
    if (server.warnlist[member.id]) {
      server.warnlist[member.id].push(
        warning
      );
    } else {
      server.warnlist[member.id] = [
        warning
      ];
    }
  }
  message.channel.send('✅ Voice Muted');
};
{'fraction_non_alphanumeric': 0.15428692699490662, 'fraction_numerical': 0.026740237691001697, 'mean_word_length': 3.304109589041096, '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': '5409135', 'n_tokens_mistral': 1626, 'n_tokens_neox': 1549, 'n_words': 346}