<commit_before>﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Text.RegularExpressions;
using ChatExchangeDotNet;

namespace Hatman.Commands
{
    class Hat : ICommand
    {
        private readonly Regex ptn = new Regex(@"(?i)^hats?\b", Extensions.RegOpts);
        private readonly HashSet<string> hats;

        public Regex CommandPattern => ptn;

        public string Description => "Hats, hats, hats, hats, more hats with a side order of hats.";

        public string Usage => "Hat";


        public Hat()
        {
            hats = new GoogleImg("silly hats").GetPicUrls();
            var moreHats = new GoogleImg("funny hats").GetPicUrls();
            foreach (var hat in moreHats)
            {
                hats.Add(hat);
            }
        }



        public void ProcessMessage(Message msg, ref Room rm)
        {
            var hat = "";

            while (string.IsNullOrWhiteSpace(hat))
            {
                try
                {
                    var url = hats.PickRandom();
                    new WebClient().DownloadData(url);
                    hat = url;
                }
                catch
                {
                    hats.Remove(hat);
                    hat = null;
                }
            }

            rm.PostReplyFast(msg, hat);
        }
    }
}
<commit_msg>Add another hat<commit_after>﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Text.RegularExpressions;
using ChatExchangeDotNet;

namespace Hatman.Commands
{
    class Hat : ICommand
    {
        private readonly Regex ptn = new Regex(@"(?i)\bhats?\b", Extensions.RegOpts);
        private readonly HashSet<string> hats;

        public Regex CommandPattern => ptn;

        public string Description => "Hats, hats, hats, hats, more hats with a side order of hats.";

        public string Usage => "Hat";


        public Hat()
        {
            hats = new GoogleImg("silly hats").GetPicUrls();
            var moreHats = new GoogleImg("funny hats").GetPicUrls();
            foreach (var hat in moreHats)
            {
                hats.Add(hat);
            }

            hats.Add("http://i.stack.imgur.com/I8zdQ.jpg");
        }



        public void ProcessMessage(Message msg, ref Room rm)
        {
            var hat = "";

            while (string.IsNullOrWhiteSpace(hat))
            {
                try
                {
                    var url = hats.PickRandom();
                    new WebClient().DownloadData(url);
                    hat = url;
                }
                catch
                {
                    hats.Remove(hat);
                    hat = null;
                }
            }

            rm.PostReplyFast(msg, hat);
        }
    }
}

{'fraction_non_alphanumeric': 0.09785714285714285, 'fraction_numerical': 0.00035714285714285714, 'mean_word_length': 1.3657094594594594, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1268246', 'n_tokens_mistral': 796, 'n_tokens_neox': 723, 'n_words': 185}