mirror of
https://github.com/RPCS3/discord-bot.git
synced 2025-03-09 04:12:05 +00:00
Merge pull request #120 from 13xforever/vnext
Update title info formatting for compat search results and embeds
This commit is contained in:
commit
d9381af291
@ -177,7 +177,7 @@ Example usage:
|
||||
|
||||
var channel = ctx.Channel.IsPrivate ? ctx.Channel : await ctx.Client.GetChannelAsync(Config.BotChannelId).ConfigureAwait(false);
|
||||
foreach (var msg in FormatSearchResults(ctx, result))
|
||||
await channel.SendAutosplitMessageAsync(msg).ConfigureAwait(false);
|
||||
await channel.SendAutosplitMessageAsync(msg, blockStart:"", blockEnd:"").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private IEnumerable<string> FormatSearchResults(CommandContext ctx, CompatResult compatResult)
|
||||
@ -204,23 +204,18 @@ Example usage:
|
||||
}
|
||||
result.AppendFormat(returnCode.info, compatResult.SearchTerm);
|
||||
yield return result.ToString();
|
||||
|
||||
result.Clear();
|
||||
//var footer = $"Retrieved from: *<{request.Build(false).ToString().Replace(' ', '+')}>* in {compatResult.RequestDuration.TotalMilliseconds:0} milliseconds!";
|
||||
|
||||
if (returnCode.displayResults)
|
||||
{
|
||||
result.Append("```");
|
||||
foreach (var resultInfo in compatResult.Results.Take(request.amountRequested))
|
||||
{
|
||||
var info = resultInfo.AsString();
|
||||
result.AppendLine(info);
|
||||
}
|
||||
result.Append("```");
|
||||
yield return result.ToString();
|
||||
//yield return footer;
|
||||
}
|
||||
//else if (returnCode.displayFooter)
|
||||
// yield return footer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,9 +31,9 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
return defaultString;
|
||||
|
||||
if (link)
|
||||
return $"[{info.Pr}](https://github.com/RPCS3/rpcs3/pull/{info.Pr})";
|
||||
return $"[#{info.Pr}](https://github.com/RPCS3/rpcs3/pull/{info.Pr})";
|
||||
|
||||
return info.Pr.ToString();
|
||||
return $"#{info.Pr}";
|
||||
}
|
||||
|
||||
public static string AsString(this TitleInfo info, string titleId)
|
||||
@ -47,7 +47,7 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
if (StatusColors.TryGetValue(info.Status, out _))
|
||||
{
|
||||
var title = info.Title.Trim(40);
|
||||
return $"ID:{titleId,-9} Title:{title,-40} PR:{info.ToPrString("???"),-4} Status:{info.Status,-8} Updated:{info.ToUpdated(),-10}";
|
||||
return $"`[{titleId,-9}] {title,-40} {info.Status,8} since {info.ToUpdated(),-10} (PR {info.ToPrString("#????"),-5})` https://forums.rpcs3.net/thread-{info.Thread}.html";
|
||||
}
|
||||
|
||||
return $"Product code {titleId} was not found in compatibility database, possibly untested!";
|
||||
@ -67,8 +67,10 @@ namespace CompatBot.Utils.ResultFormatters
|
||||
if (StatusColors.TryGetValue(info.Status, out var color))
|
||||
{
|
||||
// apparently there's no formatting in the footer, but you need to escape everything in description; ugh
|
||||
var pr = info.ToPrString(@"¯\\\_(ツ)\_ /¯", true);
|
||||
var desc = $"Status: {info.Status}, PR: {pr}, Updated: {info.ToUpdated()}";
|
||||
var pr = info.ToPrString(null, true);
|
||||
var desc = $"{info.Status} since {info.ToUpdated()}";
|
||||
if (pr is string _)
|
||||
desc += $" (PR {pr})";
|
||||
if (!forLog && !string.IsNullOrEmpty(info.AlternativeTitle))
|
||||
desc = info.AlternativeTitle + Environment.NewLine + desc;
|
||||
if (!string.IsNullOrEmpty(info.WikiTitle))
|
||||
|
Loading…
x
Reference in New Issue
Block a user