<commit_before>﻿using System;
using System.Collections.Generic;
using NetIrc2;

namespace WendySharp
{
    class Devoice : Command
    {
        public Devoice()
        {
            Match = new List<string>
            {
                "devoice",
                "dehat",
                "unhat"
            };
            Usage = "[nick] ...";
            ArgumentMatch = "(?<nicks>.+)?";
            HelpText = "Takes voice from the specified user.";
            Permission = "irc.op.voice";
        }

        public override void OnCommand(CommandArguments command)
        {
            var nicks = new List<IrcString>();
            var input = command.Arguments.Groups["nicks"].Value;

            if (input.Length == 0)
            {
                nicks.Add(command.Event.Sender.Nickname);
            }
            else
            {
                var nicksTemp = input.Split(' ');
                IrcIdentity ident;

                foreach (var nick in nicksTemp)
                {
                    if (!IrcIdentity.TryParse(nick, out ident))
                    {
                        command.Reply("'{0}' is a invalid indentity.", nick);

                        return;
                    }

                    nicks.Add(ident.Nickname);
                }
            }

            var channel = Bootstrap.Client.ChannelList.GetChannel(command.Event.Recipient);

            if (channel.WeAreOpped)
            {
                Bootstrap.Client.Client.Mode(command.Event.Recipient, "-" + new string('o', nicks.Count), nicks.ToArray());
            }
            else if (channel.HasChanServ)
            {
                Bootstrap.Client.Client.Message("ChanServ", string.Format("devoice {0} {1}", channel.Name, string.Join(" ", nicks)));
            }
            else
            {
                command.Reply("I'm not opped, send help.");

                return;
            }

            Log.WriteInfo("Deop", "'{0}' took voice from {1} in {2}", command.Event.Sender, string.Join(", ", nicks), command.Event.Recipient);
        }
    }
}<commit_msg>Fix invalid mode in devoice command<commit_after>﻿using System;
using System.Collections.Generic;
using NetIrc2;

namespace WendySharp
{
    class Devoice : Command
    {
        public Devoice()
        {
            Match = new List<string>
            {
                "devoice",
                "dehat",
                "unhat"
            };
            Usage = "[nick] ...";
            ArgumentMatch = "(?<nicks>.+)?";
            HelpText = "Takes voice from the specified user.";
            Permission = "irc.op.voice";
        }

        public override void OnCommand(CommandArguments command)
        {
            var nicks = new List<IrcString>();
            var input = command.Arguments.Groups["nicks"].Value;

            if (input.Length == 0)
            {
                nicks.Add(command.Event.Sender.Nickname);
            }
            else
            {
                var nicksTemp = input.Split(' ');
                IrcIdentity ident;

                foreach (var nick in nicksTemp)
                {
                    if (!IrcIdentity.TryParse(nick, out ident))
                    {
                        command.Reply("'{0}' is a invalid indentity.", nick);

                        return;
                    }

                    nicks.Add(ident.Nickname);
                }
            }

            var channel = Bootstrap.Client.ChannelList.GetChannel(command.Event.Recipient);

            if (channel.WeAreOpped)
            {
                Bootstrap.Client.Client.Mode(command.Event.Recipient, "-" + new string('v', nicks.Count), nicks.ToArray());
            }
            else if (channel.HasChanServ)
            {
                Bootstrap.Client.Client.Message("ChanServ", string.Format("devoice {0} {1}", channel.Name, string.Join(" ", nicks)));
            }
            else
            {
                command.Reply("I'm not opped, send help.");

                return;
            }

            Log.WriteInfo("Devoice", "'{0}' took voice from {1} in {2}", command.Event.Sender, string.Join(", ", nicks), command.Event.Recipient);
        }
    }
}
{'fraction_non_alphanumeric': 0.11896264572924102, 'fraction_numerical': 0.0038068046633357128, 'mean_word_length': 1.277356446370531, 'pattern_counts': {'":': 0, '<': 9, '<?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': '7086731', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1071, 'n_words': 225}