<commit_before>﻿using CompatApiClient.Utils;
using DSharpPlus.Entities;
using IrdLibraryClient;
using IrdLibraryClient.POCOs;

namespace CompatBot.Utils.ResultFormatters
{
    public static class IrdSearchResultFormattercs
    {
        public static DiscordEmbedBuilder AsEmbed(this SearchResult searchResult)
        {
            var result = new DiscordEmbedBuilder
            {
                //Title = "IRD Library Search Result",
                Color = Config.Colors.DownloadLinks,
            };
            if (searchResult.Data.Count == 0)
            {
                result.Color = Config.Colors.LogResultFailed;
                result.Description = "No matches were found";
                return result;
            }

            foreach (var item in searchResult.Data)
            {
                var parts = item.Filename?.Split('-');
                if (parts == null)
                    parts = new string[] {null, null};
                else if (parts.Length == 1)
                    parts = new[] {null, item.Filename};
                result.AddField(
                    $"[{parts?[0]}] {item.Title?.Sanitize().Trim(EmbedPager.MaxFieldTitleLength)}",
                    $"⏬ [`{parts[1]?.Sanitize().Trim(200)}`]({IrdClient.GetDownloadLink(item.Filename)})　ℹ [Info]({IrdClient.GetInfoLink(item.Filename)})"
                );
            }
            return result;
        }
    }
}<commit_msg>Add game version to the results (for e.g. heavy rain)<commit_after>﻿using CompatApiClient.Utils;
using DSharpPlus.Entities;
using IrdLibraryClient;
using IrdLibraryClient.POCOs;

namespace CompatBot.Utils.ResultFormatters
{
    public static class IrdSearchResultFormattercs
    {
        public static DiscordEmbedBuilder AsEmbed(this SearchResult searchResult)
        {
            var result = new DiscordEmbedBuilder
            {
                //Title = "IRD Library Search Result",
                Color = Config.Colors.DownloadLinks,
            };
            if (searchResult.Data.Count == 0)
            {
                result.Color = Config.Colors.LogResultFailed;
                result.Description = "No matches were found";
                return result;
            }

            foreach (var item in searchResult.Data)
            {
                var parts = item.Filename?.Split('-');
                if (parts == null)
                    parts = new string[] {null, null};
                else if (parts.Length == 1)
                    parts = new[] {null, item.Filename};
                result.AddField(
                    $"[{parts?[0]} v{item.GameVersion}] {item.Title?.Sanitize().Trim(EmbedPager.MaxFieldTitleLength)}",
                    $"⏬ [`{parts[1]?.Sanitize().Trim(200)}`]({IrdClient.GetDownloadLink(item.Filename)})　ℹ [Info]({IrdClient.GetInfoLink(item.Filename)})"
                );
            }
            return result;
        }
    }
}
{'fraction_non_alphanumeric': 0.11023351648351648, 'fraction_numerical': 0.004807692307692308, 'mean_word_length': 1.7173507462686568, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2890886', 'n_tokens_mistral': 811, 'n_tokens_neox': 756, 'n_words': 162}