<commit_before>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using SoraBot_v2.Data;
using SoraBot_v2.Services;
using Weeb.net;

namespace SoraBot_v2.Module
{
    public class InteractionModule : ModuleBase<SocketCommandContext>
    {
        
        private readonly InteractionsService _interactions;
        private readonly WeebService _weebService;

        public InteractionModule(InteractionsService interactionsService, WeebService weebService)
        {
            _interactions = interactionsService;
            _weebService = weebService;
        }
        
        [Command("pat",RunMode = RunMode.Async), Summary("Pats the specified person")]
        public async Task Pat([Summary("Mention the users you want to pat and maybe add a reason"), Remainder] string reason)
        {
            SocketUser[] usersT = Context.Message.MentionedUsers.ToArray();
            if (usersT.Length < 1)
            {
                await AtLeast1Param(Context);
                return;
            }
            var eb = new EmbedBuilder
            {
                Color = Utility.PurpleEmbed,
            };
            
            var users = usersT.Distinct().ToList();

            var sameAsInvoker = users.FirstOrDefault(x => x.Id == Context.User.Id);
            if(sameAsInvoker !=null)
            {
                users.Remove(sameAsInvoker);
                if (users.Count == 0)
                {
                    eb.Title =
                        $"{Utility.GiveUsernameDiscrimComb(Context.User)}, why are you patting yourself? Are you okay? ｡ﾟ･（>﹏<）･ﾟ｡";
                    eb.ImageUrl = "https://i.imgur.com/QFtH3Gl.gif";

                    await Context.Channel.SendMessageAsync("", embed: eb);
                    return;
                }
            }
            /*
            var r = new Random();
            
            eb.ImageUrl = $"{Utility.Pats[r.Next(0, Utility.Pats.Length)]}";
            */

            eb.Footer = new EmbedFooterBuilder()
            {
                Text = "Powered by weeb.sh and the weeb.net wrapper"
            };
            var image = await _weebService.GetRandImage("pat", new string[] { }, FileType.Gif, NsfwSearch.False);
            eb.ImageUrl = image.Url;
            string patted ="";
            users.ForEach(x=>patted += Utility.GiveUsernameDiscrimComb(x)+", ");
            patted = (patted.Length > 200 ? $"{patted.Remove(200)}..." : patted);
            eb.Title =
                $"{Utility.GiveUsernameDiscrimComb(Context.User)} pats {patted.Remove(patted.Length-2)} ｡◕ ‿ ◕｡";

            using (var _soraContext = new SoraContext())
            {
                await _interactions.InteractMultiple(InteractionType.Pat, users, Context, _soraContext);
            }

            await Context.Channel.SendMessageAsync("", embed: eb);
        }
        
        [Command("hug",RunMode = RunMode.Async), Summary("Hugs the specified person")]
        public async Task Hug([Summary("Mention the users you want to hug and maybe add a reason"), Remainder]string reason)
        {
            SocketUser[] usersT = Context.Message.MentionedUsers.ToArray();
            if (usersT.Length < 1)
            {
                await AtLeast1Param(Context);
                return;
            }
            
            var eb = new EmbedBuilder
            {
                Color = Utility.PurpleEmbed,
            };

            var users = usersT.Distinct().ToList();

            var sameAsInvoker = users.FirstOrDefault(x => x.Id == Context.User.Id);
            if(sameAsInvoker != null)
            {
                users.Remove(sameAsInvoker);
                if (users.Count == 0)
                {
                    eb.Title =
                        $"{Utility.GiveUsernameDiscrimComb(Context.User)} don't hug yourself ;-; At least take this pillow (̂ ˃̥̥̥ ˑ̫ ˂̥̥̥ )̂ ";
                    eb.ImageUrl = "http://i.imgur.com/CM0of.gif";
                    await Context.Channel.SendMessageAsync("", embed: eb);
                    return;
                }
            }
            using (var _soraContext = new SoraContext())
            {
                await _interactions.InteractMultiple(InteractionType.Hug, users, Context, _soraContext);
            }
            /*
            var r = new Random();
            eb.ImageUrl = $"{Utility.Hugs[r.Next(0, Utility.Hugs.Length)]}";*/
            
            eb.Footer = new EmbedFooterBuilder()
            {
                Text = "Powered by weeb.sh and the weeb.net wrapper"
            };
            var image = await _weebService.GetRandImage("hug", new string[] { }, FileType.Gif, NsfwSearch.False);
            eb.ImageUrl = image.Url;
            
            string hugged = "";
            users.ForEach(x=> hugged+= Utility.GiveUsernameDiscrimComb(x)+", ");
            hugged = (hugged.Length > 200 ? $"{hugged.Remove(200)}..." : hugged);

            eb.Title = $"{Utility.GiveUsernameDiscrimComb(Context.User)} hugged {hugged.Remove(hugged.Length-2)} °˖✧◝(⁰▿⁰)◜✧˖°";
            await Context.Channel.SendMessageAsync("", embed: eb);
        }
        
        [Command("high5"), Alias("h5"), Summary("High5 the specified person")]
        public async Task High5([Summary("Mention the users you want to high5 and maybe add a reason"), Remainder]string reason)
        {
            SocketUser[] usersT = Context.Message.MentionedUsers.ToArray();
            if (usersT.Length < 1)
            {
                await AtLeast1Param(Context);
                return;
            }
            var eb = new EmbedBuilder
            {
                Color = Utility.PurpleEmbed,
            };
            var r = new Random();

            var users = usersT.Distinct().ToList();
            var sameAsInvoker = users.FirstOrDefault(x => x.Id == Context.User.Id);
            if(sameAsInvoker!= null)
            {
                users.Remove(sameAsInvoker);
                if (users.Count == 0)
                {
                    eb.Title =
                        $"{Utility.GiveUsernameDiscrimComb(Context.User)} no friends to high five? (̂ ˃̥̥̥ ˑ̫ ˂̥̥̥ )̂ ";
                    eb.ImageUrl = $"{Utility.Self5[r.Next(0, Utility.Self5.Length)]}";
                    await Context.Channel.SendMessageAsync("", embed: eb);
                    return;
                }
            }
            using (var _soraContext = new SoraContext())
            {
                await _interactions.InteractMultiple(InteractionType.High5, users, Context, _soraContext);
            }
            var high5ed = "";
            users.ForEach(x=>high5ed+= Utility.GiveUsernameDiscrimComb(x)+", ");
            high5ed = (high5ed.Length > 200 ? $"{high5ed.Remove(200)}..." : high5ed);

            eb.ImageUrl = $"{Utility.High5[r.Next(0, Utility.High5.Length)]}";
            eb.Title = $"{Utility.GiveUsernameDiscrimComb(Context.User)} high fived {high5ed.Remove(high5ed.Length -2)} °˖✧◝(⁰▿⁰)◜✧˖°";
            await Context.Channel.SendMessageAsync("", embed: eb);
        }

        [Command("reset"), Summary("Resets your own stats")]
        public async Task Reset()
        {
            //TODO AFFINITY RESET
            await ReplyAsync("Under construction");
        }

        [Command("poke",RunMode = RunMode.Async), Summary("Pokes the specified person")]
        public async Task Poke([Summary("Mention the users you want to poke and maybe add a reason"), Remainder]string reason)
        {
            SocketUser[] usersT = Context.Message.MentionedUsers.ToArray();
            if (usersT.Length < 1)
            {
                await AtLeast1Param(Context);
                return;
            }
            var users = usersT.Distinct().ToList();

            var sameAsInvoker = users.FirstOrDefault(x => x.Id == Context.User.Id);
            var r = new Random();
            string poked = "";
            users.ForEach(x=> poked+=Utility.GiveUsernameDiscrimComb(x)+", ");
            poked = (poked.Length > 200 ? $"{poked.Remove(200)}..." : poked);
            
            var image = await _weebService.GetRandImage("poke", new string[] { }, FileType.Gif, NsfwSearch.False);

            var eb = new EmbedBuilder()
            {
                Color = Utility.PurpleEmbed,
                Title = $"{Utility.GiveUsernameDiscrimComb(Context.User)} poked {poked.Remove(poked.Length-2)} ( ≧Д≦)",
                ImageUrl = image.Url,//$"{Utility.Pokes[r.Next(0, Utility.Pokes.Length )]}"
                Footer = new EmbedFooterBuilder()
                {
                    Text = "Powered by weeb.sh and the weeb.net wrapper"
                }
            };<commit_msg>unnecessary stuff<commit_after>﻿using System;
using System.Linq;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using SoraBot_v2.Data;
using SoraBot_v2.Services;
using Weeb.net;

namespace SoraBot_v2.Module
{
    public class InteractionModule : ModuleBase<SocketCommandContext>
    {
        
        private readonly InteractionsService _interactions;
        private readonly WeebService _weebService;

        public InteractionModule(InteractionsService interactionsService, WeebService weebService)
        {
            _interactions = interactionsService;
            _weebService = weebService;
        }
        
        [Command("pat",RunMode = RunMode.Async), Summary("Pats the specified person")]
        public async Task Pat([Summary("Mention the users you want to pat and maybe add a reason"), Remainder] string reason)
        {
            SocketUser[] usersT = Context.Message.MentionedUsers.ToArray();
            if (usersT.Length < 1)
            {
                await AtLeast1Param(Context);
                return;
            }
            var eb = new EmbedBuilder
            {
                Color = Utility.PurpleEmbed,
            };
            
            var users = usersT.Distinct().ToList();

            var sameAsInvoker = users.FirstOrDefault(x => x.Id == Context.User.Id);
            if(sameAsInvoker !=null)
            {
                users.Remove(sameAsInvoker);
                if (users.Count == 0)
                {
                    eb.Title =
                        $"{Utility.GiveUsernameDiscrimComb(Context.User)}, why are you patting yourself? Are you okay? ｡ﾟ･（>﹏<）･ﾟ｡";
                    eb.ImageUrl = "https://i.imgur.com/QFtH3Gl.gif";

                    await Context.Channel.SendMessageAsync("", embed: eb);
                    return;
                }
            }
            /*
            var r = new Random();
            
            eb.ImageUrl = $"{Utility.Pats[r.Next(0, Utility.Pats.Length)]}";
            */

            eb.Footer = new EmbedFooterBuilder()
            {
                Text = "Powered by weeb.sh and the weeb.net wrapper"
            };
            var image = await _weebService.GetRandImage("pat", new string[] { }, FileType.Gif, NsfwSearch.False);
            eb.ImageUrl = image.Url;
            string patted ="";
            users.ForEach(x=>patted += Utility.GiveUsernameDiscrimComb(x)+", ");
            patted = (patted.Length > 200 ? $"{patted.Remove(200)}..." : patted);
            eb.Title =
                $"{Utility.GiveUsernameDiscrimComb(Context.User)} pats {patted.Remove(patted.Length-2)} ｡◕ ‿ ◕｡";

            using (var _soraContext = new SoraContext())
            {
                await _interactions.InteractMultiple(InteractionType.Pat, users, Context, _soraContext);
            }

            await Context.Channel.SendMessageAsync("", embed: eb);
        }
        
        [Command("hug",RunMode = RunMode.Async), Summary("Hugs the specified person")]
        public async Task Hug([Summary("Mention the users you want to hug and maybe add a reason"), Remainder]string reason)
        {
            SocketUser[] usersT = Context.Message.MentionedUsers.ToArray();
            if (usersT.Length < 1)
            {
                await AtLeast1Param(Context);
                return;
            }
            
            var eb = new EmbedBuilder
            {
                Color = Utility.PurpleEmbed,
            };

            var users = usersT.Distinct().ToList();

            var sameAsInvoker = users.FirstOrDefault(x => x.Id == Context.User.Id);
            if(sameAsInvoker != null)
            {
                users.Remove(sameAsInvoker);
                if (users.Count == 0)
                {
                    eb.Title =
                        $"{Utility.GiveUsernameDiscrimComb(Context.User)} don't hug yourself ;-; At least take this pillow (̂ ˃̥̥̥ ˑ̫ ˂̥̥̥ )̂ ";
                    eb.ImageUrl = "http://i.imgur.com/CM0of.gif";
                    await Context.Channel.SendMessageAsync("", embed: eb);
                    return;
                }
            }
            using (var _soraContext = new SoraContext())
            {
                await _interactions.InteractMultiple(InteractionType.Hug, users, Context, _soraContext);
            }
            /*
            var r = new Random();
            eb.ImageUrl = $"{Utility.Hugs[r.Next(0, Utility.Hugs.Length)]}";*/
            
            eb.Footer = new EmbedFooterBuilder()
            {
                Text = "Powered by weeb.sh and the weeb.net wrapper"
            };
            var image = await _weebService.GetRandImage("hug", new string[] { }, FileType.Gif, NsfwSearch.False);
            eb.ImageUrl = image.Url;
            
            string hugged = "";
            users.ForEach(x=> hugged+= Utility.GiveUsernameDiscrimComb(x)+", ");
            hugged = (hugged.Length > 200 ? $"{hugged.Remove(200)}..." : hugged);

            eb.Title = $"{Utility.GiveUsernameDiscrimComb(Context.User)} hugged {hugged.Remove(hugged.Length-2)} °˖✧◝(⁰▿⁰)◜✧˖°";
            await Context.Channel.SendMessageAsync("", embed: eb);
        }
        
        [Command("high5"), Alias("h5"), Summary("High5 the specified person")]
        public async Task High5([Summary("Mention the users you want to high5 and maybe add a reason"), Remainder]string reason)
        {
            SocketUser[] usersT = Context.Message.MentionedUsers.ToArray();
            if (usersT.Length < 1)
            {
                await AtLeast1Param(Context);
                return;
            }
            var eb = new EmbedBuilder
            {
                Color = Utility.PurpleEmbed,
            };
            var r = new Random();

            var users = usersT.Distinct().ToList();
            var sameAsInvoker = users.FirstOrDefault(x => x.Id == Context.User.Id);
            if(sameAsInvoker!= null)
            {
                users.Remove(sameAsInvoker);
                if (users.Count == 0)
                {
                    eb.Title =
                        $"{Utility.GiveUsernameDiscrimComb(Context.User)} no friends to high five? (̂ ˃̥̥̥ ˑ̫ ˂̥̥̥ )̂ ";
                    eb.ImageUrl = $"{Utility.Self5[r.Next(0, Utility.Self5.Length)]}";
                    await Context.Channel.SendMessageAsync("", embed: eb);
                    return;
                }
            }
            using (var _soraContext = new SoraContext())
            {
                await _interactions.InteractMultiple(InteractionType.High5, users, Context, _soraContext);
            }
            var high5ed = "";
            users.ForEach(x=>high5ed+= Utility.GiveUsernameDiscrimComb(x)+", ");
            high5ed = (high5ed.Length > 200 ? $"{high5ed.Remove(200)}..." : high5ed);

            eb.ImageUrl = $"{Utility.High5[r.Next(0, Utility.High5.Length)]}";
            eb.Title = $"{Utility.GiveUsernameDiscrimComb(Context.User)} high fived {high5ed.Remove(high5ed.Length -2)} °˖✧◝(⁰▿⁰)◜✧˖°";
            await Context.Channel.SendMessageAsync("", embed: eb);
        }

        [Command("poke",RunMode = RunMode.Async), Summary("Pokes the specified person")]
        public async Task Poke([Summary("Mention the users you want to poke and maybe add a reason"), Remainder]string reason)
        {
            SocketUser[] usersT = Context.Message.MentionedUsers.ToArray();
            if (usersT.Length < 1)
            {
                await AtLeast1Param(Context);
                return;
            }
            var users = usersT.Distinct().ToList();

            var sameAsInvoker = users.FirstOrDefault(x => x.Id == Context.User.Id);
            var r = new Random();
            string poked = "";
            users.ForEach(x=> poked+=Utility.GiveUsernameDiscrimComb(x)+", ");
            poked = (poked.Length > 200 ? $"{poked.Remove(200)}..." : poked);
            
            var image = await _weebService.GetRandImage("poke", new string[] { }, FileType.Gif, NsfwSearch.False);

            var eb = new EmbedBuilder()
            {
                Color = Utility.PurpleEmbed,
                Title = $"{Utility.GiveUsernameDiscrimComb(Context.User)} poked {poked.Remove(poked.Length-2)} ( ≧Д≦)",
                ImageUrl = image.Url,//$"{Utility.Pokes[r.Next(0, Utility.Pokes.Length )]}"
                Footer = new EmbedFooterBuilder()
                {
                    Text = "Powered by weeb.sh and the weeb.net wrapper"
                }
            };
{'fraction_non_alphanumeric': 0.12151693837437855, 'fraction_numerical': 0.007746560295987976, 'mean_word_length': 1.672072907012666, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 31, 'https://': 2, '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': '7052417', 'n_tokens_mistral': 5167, 'n_tokens_neox': 4931, 'n_words': 1008}