Support for embeds in .qsearch output
- Support for embeds in .qsearch output results
- Search can be case insensitive (changes made 011b951a29
)
- Output shows keyword in lowercase as it's easier to read (line 104)
- Minor syntax cleanups
This commit is contained in:
parent
011b951a29
commit
9344c1b498
@ -72,8 +72,8 @@ namespace NadekoBot.Modules.Utility
|
||||
await Context.Channel.SendMessageAsync("📣 " + quote.Text.SanitizeMentions());
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task SearchQuote(string keyword, [Remainder] string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
|
||||
@ -83,14 +83,25 @@ namespace NadekoBot.Modules.Utility
|
||||
|
||||
Quote keywordquote;
|
||||
using (var uow = DbHandler.UnitOfWork())
|
||||
{
|
||||
{
|
||||
keywordquote = await uow.Quotes.SearchQuoteKeywordTextAsync(Context.Guild.Id, keyword, text).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (keywordquote == null)
|
||||
return;
|
||||
|
||||
await Context.Channel.SendMessageAsync("💬 " + keyword + ": " + keywordquote.Text.SanitizeMentions());
|
||||
|
||||
CREmbed crembed;
|
||||
if (CREmbed.TryParse(keywordquote.Text, out crembed))
|
||||
{
|
||||
try { await Context.Channel.EmbedAsync(crembed.ToEmbed(), crembed.PlainText ?? "").ConfigureAwait(false); }
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Warn("Sending CREmbed failed");
|
||||
_log.Warn(ex);
|
||||
}
|
||||
return;
|
||||
}
|
||||
await Context.Channel.SendMessageAsync("💬 " + keyword.toLowerInvariant(); + ": " + keywordquote.Text.SanitizeMentions());
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
|
Loading…
Reference in New Issue
Block a user