Potential fix for no-show quoteshow

This commit is contained in:
Cata
2023-12-11 23:24:04 +00:00
committed by Kwoth
parent 77358a563d
commit 340c5b2268

View File

@@ -127,15 +127,27 @@ public partial class Utility
} }
private async Task ShowQuoteData(Quote data) private async Task ShowQuoteData(Quote data)
=> await ctx.Channel.EmbedAsync(_eb.Create(ctx) {
.WithOkColor() var eb = _eb.Create(ctx)
.WithTitle(GetText(strs.quote_id($"#{data.Id}"))) .WithOkColor()
.AddField(GetText(strs.trigger), data.Keyword) .WithTitle($"{GetText(strs.quote_id($"#{data.Id}"))} | {GetText(strs.response)}:")
.AddField(GetText(strs.response), .WithDescription(Format.Sanitize(data.Text).Replace("](", "]\\(").TrimTo(4096))
Format.Sanitize(data.Text).Replace("](", "]\\(")) .AddField(GetText(strs.trigger), data.Keyword)
.WithFooter( .WithFooter(
GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})")))); GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})")))
.Build();
if (!(data.Text.Length > 4096))
{
await ctx.Channel.SendMessageAsync(embed: eb);
return;
}
await ctx.Channel.SendFileAsync(
attachment: new FileAttachment(await data.Text.ToStream(), "quote.txt"),
embed: eb);
}
private async Task QuoteSearchinternalAsync(string? keyword, string textOrAuthor) private async Task QuoteSearchinternalAsync(string? keyword, string textOrAuthor)
{ {
if (string.IsNullOrWhiteSpace(textOrAuthor)) if (string.IsNullOrWhiteSpace(textOrAuthor))