<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using DSharpPlus;

namespace ModCore.Logic
{
    public static class AsyncListenerHandler
    {
        public static IEnumerable<ListenerMethod> ListenerMethods { get; private set; }
        
        public static void InstallListeners(DiscordClient client, Bot bot)
        {
            // find all methods from ModCore with AsyncListener attr
            ListenerMethods =
                from a in AppDomain.CurrentDomain.GetAssemblies()
                from t in a.GetTypes()
                where t.Namespace.StartsWith("ModCore")
                from m in t.GetMethods()
                let attribute = m.GetCustomAttribute(typeof(AsyncListenerAttribute), true)
                where attribute != null
                select new ListenerMethod { Method = m, Attribute = attribute as AsyncListenerAttribute };

            foreach (var listener in ListenerMethods)
            {
                listener.Attribute.Register(bot, client, listener.Method);
            }
        }
    }

    public class ListenerMethod
    {
        public MethodInfo Method { get; internal set; }
        public AsyncListenerAttribute Attribute { get; internal set; }
    }
}<commit_msg>Oh hey this seems to fix it<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using DSharpPlus;

namespace ModCore.Logic
{
    public static class AsyncListenerHandler
    {
        public static IEnumerable<ListenerMethod> ListenerMethods { get; private set; }
        
        public static void InstallListeners(DiscordClient client, Bot bot)
        {
            // find all methods from ModCore with AsyncListener attr
            ListenerMethods =
                from a in AppDomain.CurrentDomain.GetAssemblies()
                from t in a.GetTypes()
                //where t.Namespace.StartsWith("ModCore")
                from m in t.GetMethods()
                let attribute = m.GetCustomAttribute(typeof(AsyncListenerAttribute), true)
                where attribute != null
                select new ListenerMethod { Method = m, Attribute = attribute as AsyncListenerAttribute };

            foreach (var listener in ListenerMethods)
            {
                listener.Attribute.Register(bot, client, listener.Method);
            }
        }
    }

    public class ListenerMethod
    {
        public MethodInfo Method { get; internal set; }
        public AsyncListenerAttribute Attribute { get; internal set; }
    }
}
{'fraction_non_alphanumeric': 0.06656346749226007, 'fraction_numerical': 0.0, 'mean_word_length': 2.164014687882497, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '350139', 'n_tokens_mistral': 618, 'n_tokens_neox': 598, 'n_words': 190}