Merge branch 'v4' into 'v4'

Potential fix for no-show quoteshow

See merge request Kwoth/nadekobot!311
This commit is contained in:
Kwoth
2023-12-11 23:24:04 +00:00

View File

@@ -127,15 +127,27 @@ public partial class Utility
}
private async Task ShowQuoteData(Quote data)
=> await ctx.Channel.EmbedAsync(_eb.Create(ctx)
.WithOkColor()
.WithTitle(GetText(strs.quote_id($"#{data.Id}")))
.AddField(GetText(strs.trigger), data.Keyword)
.AddField(GetText(strs.response),
Format.Sanitize(data.Text).Replace("](", "]\\("))
.WithFooter(
GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})"))));
{
var eb = _eb.Create(ctx)
.WithOkColor()
.WithTitle($"{GetText(strs.quote_id($"#{data.Id}"))} | {GetText(strs.response)}:")
.WithDescription(Format.Sanitize(data.Text).Replace("](", "]\\(").TrimTo(4096))
.AddField(GetText(strs.trigger), data.Keyword)
.WithFooter(
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)
{
if (string.IsNullOrWhiteSpace(textOrAuthor))