<commit_before>﻿using BotVentic.Json;
using Discord;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;

namespace BotVentic
{
    class Program
    {
        // DictEmotes <EmoteCode, { emote_id, emote_type }>
        public static Dictionary<string, string[]> DictEmotes { get; private set; }
        public static string BttvTemplate { get; private set; }

        public static int EditThreshold { get; set; }
        public static int EditMax { get; set; }
        public static List<string> FFZEmoteSets = new List<string>();

        static void Main(string[] args)
        {
            FFZEmoteSets.Add("3"); // Global endpoint
            FFZEmoteSets.Add("4330"); // Weird new globals



            Console.WriteLine("Version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            DictEmotes = new Dictionary<string, string[]>();

            Config config;
            if (File.Exists("config.json"))
            {
                using (StreamReader sr = new StreamReader("config.json"))
                {
                    config = JsonConvert.DeserializeObject<Config>(sr.ReadToEnd());
                    EditThreshold = config.EditThreshold;
                    EditMax = config.EditMax;
                }
            }
            else
            {
                Console.WriteLine("No config file present!");
                System.Threading.Thread.Sleep(4000);
                return;
            }

            Console.WriteLine("Started!");

            UpdateAllEmotes();

            Console.WriteLine("Emotes acquired!");

            var client = new DiscordClient(new DiscordClientConfig());

            client.MessageCreated += MessageHandler.HandleIncomingMessage;
            client.MessageUpdated += MessageHandler.HandleEdit;

            client.Run(async () =>
            {
                Console.WriteLine("Connecting...");
                try
                {
                    await client.Connect(config.Email, config.Password);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    return;
                }
                Console.WriteLine("Connected!");
            });
            Console.WriteLine("Press Any key to quit");
            Console.ReadKey();
        }

        /// <summary>
        /// Update the list of all emoticons
        /// </summary>
        public static void UpdateAllEmotes()
        {
            DictEmotes.Clear();
            UpdateFFZEmotes();
            UpdateBttvEmotes();
            UpdateEmotes();
        }

        /// <summary>
        /// Update the list of emoticons
        /// </summary>
        public static void UpdateEmotes()
        {
            var emotes = JsonConvert.DeserializeObject<EmoticonImages>(Request("https://api.twitch.tv/kraken/chat/emoticon_images"));

            if (emotes == null || emotes.Emotes == null)<commit_msg>HTTPS Breaks linux. Temporary Fix<commit_after>﻿using BotVentic.Json;
using Discord;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;

namespace BotVentic
{
    class Program
    {
        // DictEmotes <EmoteCode, { emote_id, emote_type }>
        public static Dictionary<string, string[]> DictEmotes { get; private set; }
        public static string BttvTemplate { get; private set; }

        public static int EditThreshold { get; set; }
        public static int EditMax { get; set; }
        public static List<string> FFZEmoteSets = new List<string>();

        static void Main(string[] args)
        {
            FFZEmoteSets.Add("3"); // Global endpoint
            FFZEmoteSets.Add("4330"); // Weird new globals



            Console.WriteLine("Version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());
            DictEmotes = new Dictionary<string, string[]>();

            Config config;
            if (File.Exists("config.json"))
            {
                using (StreamReader sr = new StreamReader("config.json"))
                {
                    config = JsonConvert.DeserializeObject<Config>(sr.ReadToEnd());
                    EditThreshold = config.EditThreshold;
                    EditMax = config.EditMax;
                }
            }
            else
            {
                Console.WriteLine("No config file present!");
                System.Threading.Thread.Sleep(4000);
                return;
            }

            Console.WriteLine("Started!");

            UpdateAllEmotes();

            Console.WriteLine("Emotes acquired!");

            var client = new DiscordClient(new DiscordClientConfig());

            client.MessageCreated += MessageHandler.HandleIncomingMessage;
            client.MessageUpdated += MessageHandler.HandleEdit;

            client.Run(async () =>
            {
                Console.WriteLine("Connecting...");
                try
                {
                    await client.Connect(config.Email, config.Password);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                    return;
                }
                Console.WriteLine("Connected!");
            });
            Console.WriteLine("Press Any key to quit");
            Console.ReadKey();
        }

        /// <summary>
        /// Update the list of all emoticons
        /// </summary>
        public static void UpdateAllEmotes()
        {
            DictEmotes.Clear();
            UpdateFFZEmotes();
            UpdateBttvEmotes();
            UpdateEmotes();
        }

        /// <summary>
        /// Update the list of emoticons
        /// </summary>
        public static void UpdateEmotes()
        {
            var emotes = JsonConvert.DeserializeObject<EmoticonImages>(Request("http://api.twitch.tv/kraken/chat/emoticon_images"));

            if (emotes == null || emotes.Emotes == null)
{'fraction_non_alphanumeric': 0.10708998190491857, 'fraction_numerical': 0.0029610133245599607, 'mean_word_length': 1.6161790017211703, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 1, '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': '6486491', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1457, 'n_words': 323}