<commit_before>﻿using IA.Database;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IA.SDK.Interfaces;
using IA.SDK.Events;
using IA.Events;

namespace IA.SDK
{
    class RuntimeAddonInstance : IAddonInstance
    {
        public string Name { get; set; } = "";
        public List<IModule> Modules { get; set; } = new List<IModule>();
        Bot bot = null;

        public RuntimeAddonInstance()
        {
        }
        public RuntimeAddonInstance(IAddonInstance i, Bot bot)
        {
            Name = i.Name;
            Modules = i.Modules;
            this.bot = bot;
        }

        public async Task QueryAsync(string text, QueryOutput output, params object[] parameters)
        {
            await Sql.QueryAsync(text, output, parameters);
        }

        public string GetBotVersion()
        {
            return Bot.instance.Version;
        }

        public async Task<string> ListCommands(IDiscordMessage e)
        {
            return await Bot.instance.Events.ListCommands(e);
        }
        public async Task<IDiscordEmbed> ListCommandsInEmbed(IDiscordMessage e)
        {
            return await Bot.instance.Events.ListCommandsInEmbed(e);
        }

        public ICommandEvent GetCommandEvent(string args)
        {
            return Bot.instance.Events.GetCommandEvent(args);
        }

        public void CreateModule(Action<IModule> module)
        {
            IModule m = new RuntimeModule(module);
            Modules.Add(m);
        }

        public EventAccessibility GetUserAccessibility(IDiscordMessage message)
        {
            return Bot.instance.Events.GetUserAccessibility(message);
        }

        public async Task<string> GetIdentifierAsync(ulong serverid)
        {
            return await Bot.instance.Events.GetIdentifier(serverid);
        }

        public List<IModule> GetModules()
        {
            return Bot.instance.Events.Modules.Values.ToList();
        }

        public async Task SetIdentifierAsync(IDiscordGuild guild, string identifier)
        {
            await Bot.instance.Events.SetIdentifierAsync(guild, identifier);
        }
    }
}<commit_msg>Add: more helper functions for sdk<commit_after>﻿using IA.Database;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IA.SDK.Interfaces;
using IA.SDK.Events;
using IA.Events;

namespace IA.SDK
{
    class RuntimeAddonInstance : IAddonInstance
    {
        public string Name { get; set; } = "";
        public List<IModule> Modules { get; set; } = new List<IModule>();
        Bot bot = null;

        public RuntimeAddonInstance()
        {
        }
        public RuntimeAddonInstance(IAddonInstance i, Bot bot)
        {
            Name = i.Name;
            Modules = i.Modules;
            this.bot = bot;
        }

        public async Task QueryAsync(string text, QueryOutput output, params object[] parameters)
        {
            await Sql.QueryAsync(text, output, parameters);
        }

        public string GetBotVersion()
        {
            return Bot.instance.Version;
        }

        public async Task<string> ListCommands(IDiscordMessage e)
        {
            return await Bot.instance.Events.ListCommands(e);
        }
        public async Task<IDiscordEmbed> ListCommandsInEmbed(IDiscordMessage e)
        {
            return await Bot.instance.Events.ListCommandsInEmbed(e);
        }

        public ICommandEvent GetCommandEvent(string args)
        {
            return Bot.instance.Events.GetCommandEvent(args);
        }

        public void CreateModule(Action<IModule> module)
        {
            IModule m = new RuntimeModule(module);
            Modules.Add(m);
        }

        public EventAccessibility GetUserAccessibility(IDiscordMessage message)
        {
            return Bot.instance.Events.GetUserAccessibility(message);
        }

        public async Task<string> GetIdentifierAsync(ulong serverid)
        {
            return await Bot.instance.Events.GetIdentifier(serverid);
        }

        public List<IModule> GetModules()
        {
            return Bot.instance.Events.Modules.Values.ToList();
        }

        public async Task SetIdentifierAsync(IDiscordGuild guild, string identifier)
        {
            await Bot.instance.Events.SetIdentifierAsync(guild, identifier);
        }

        public int GetGuildCount()
        {
            return Bot.instance.Client.Guilds.Count;
        }

        public ulong GetBotId()
        {
            return Bot.instance.Client.CurrentUser.Id;
        }
    }
}
{'fraction_non_alphanumeric': 0.08451005562687205, 'fraction_numerical': 0.0, 'mean_word_length': 2.047588005215124, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '7223446', 'n_tokens_mistral': 1267, 'n_tokens_neox': 1251, 'n_words': 275}