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:
		@@ -72,8 +72,8 @@ namespace NadekoBot.Modules.Utility
 | 
				
			|||||||
                await Context.Channel.SendMessageAsync("📣 " + quote.Text.SanitizeMentions());
 | 
					                await Context.Channel.SendMessageAsync("📣 " + quote.Text.SanitizeMentions());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
           [NadekoCommand, Usage, Description, Aliases]
 | 
					            [NadekoCommand, Usage, Description, Aliases]
 | 
				
			||||||
        [RequireContext(ContextType.Guild)] 
 | 
					            [RequireContext(ContextType.Guild)] 
 | 
				
			||||||
            public async Task SearchQuote(string keyword, [Remainder] string text)
 | 
					            public async Task SearchQuote(string keyword, [Remainder] string text)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
            if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
 | 
					            if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
 | 
				
			||||||
@@ -83,14 +83,25 @@ namespace NadekoBot.Modules.Utility
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                Quote keywordquote;
 | 
					                Quote keywordquote;
 | 
				
			||||||
                using (var uow = DbHandler.UnitOfWork())
 | 
					                using (var uow = DbHandler.UnitOfWork())
 | 
				
			||||||
               {
 | 
					                {
 | 
				
			||||||
                    keywordquote = await uow.Quotes.SearchQuoteKeywordTextAsync(Context.Guild.Id, keyword, text).ConfigureAwait(false);
 | 
					                    keywordquote = await uow.Quotes.SearchQuoteKeywordTextAsync(Context.Guild.Id, keyword, text).ConfigureAwait(false);
 | 
				
			||||||
               }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (keywordquote == null)
 | 
					                if (keywordquote == null)
 | 
				
			||||||
                    return;
 | 
					                    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]
 | 
					            [NadekoCommand, Usage, Description, Aliases]
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user