Merge branch 'dev' of https://github.com/Kwoth/NadekoBot into dev
This commit is contained in:
		 Submodule Discord.Net updated: d2229228b9...9ce5c4757e
									
								
							
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							@@ -1,14 +1,12 @@
 | 
				
			|||||||

 | 
					
 | 
				
			||||||
[](https://discord.gg/nadekobot)
 | 
					[](https://discord.gg/nadekobot)
 | 
				
			||||||
[](http://nadekobot.readthedocs.io/en/latest/?badge=latest)
 | 
					[](http://nadekobot.readthedocs.io/en/latest/?badge=latest)
 | 
				
			||||||

 | 
					[](http://nadekobot.xyz)
 | 
				
			||||||
[](https://discordapp.com/oauth2/authorize?client_id=170254782546575360&scope=bot&permissions=66186303)
 | 
					[](https://discordapp.com/oauth2/authorize?client_id=170254782546575360&scope=bot&permissions=66186303)
 | 
				
			||||||
[](http://nadekobot.readthedocs.io/en/latest/Commands%20List/)
 | 
					[](http://nadekobot.readthedocs.io/en/latest/Commands%20List/)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##For Update, Help and Guidlines
 | 
					##For Update, Help and Guidelines
 | 
				
			||||||
 | 
					 | 
				
			||||||
`Follow me on twitter for updates. | Join my Discord server if you need help. | Read the Docs for hosting guides.`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[](https://twitter.com/TheNadekoBot) [](https://discord.gg/nadekobot) [](http://nadekobot.readthedocs.io/en/latest/)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					| [](https://twitter.com/TheNadekoBot) | [](https://discord.gg/nadekobot) | [](http://nadekobot.readthedocs.io/en/latest/)
 | 
				
			||||||
 | 
					| --- | --- | --- |
 | 
				
			||||||
 | 
					| Follow me on Twitter for updates. | Join my Discord server if you need help. | Read the Docs for hosting guides. |
 | 
				
			||||||
@@ -71,6 +71,27 @@ namespace NadekoBot.Modules.Utility
 | 
				
			|||||||
                await Context.Channel.SendMessageAsync("📣 " + quote.Text.SanitizeMentions());
 | 
					                await Context.Channel.SendMessageAsync("📣 " + quote.Text.SanitizeMentions());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
 | 
					           [NadekoCommand, Usage, Description, Aliases]
 | 
				
			||||||
 | 
					  	    [RequireContext(ContextType.Guild)] 
 | 
				
			||||||
 | 
					            public async Task SearchQuote(string keyword, [Remainder] string text)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
						        if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
 | 
				
			||||||
 | 
							    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                keyword = keyword.ToUpperInvariant();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                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());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            [NadekoCommand, Usage, Description, Aliases]
 | 
					            [NadekoCommand, Usage, Description, Aliases]
 | 
				
			||||||
            [RequireContext(ContextType.Guild)]
 | 
					            [RequireContext(ContextType.Guild)]
 | 
				
			||||||
            public async Task AddQuote(string keyword, [Remainder] string text)
 | 
					            public async Task AddQuote(string keyword, [Remainder] string text)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										27
									
								
								src/NadekoBot/Resources/CommandStrings.Designer.cs
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										27
									
								
								src/NadekoBot/Resources/CommandStrings.Designer.cs
									
									
									
										generated
									
									
									
								
							@@ -2381,6 +2381,33 @@ namespace NadekoBot.Resources {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        ///    Looks up a localized string similar to qsearch.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public static string searchquote_cmd {
 | 
				
			||||||
 | 
					            get {
 | 
				
			||||||
 | 
					                return ResourceManager.GetString("searchquote_cmd", resourceCulture);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        ///    Looks up a localized string similar to Searches a quote for a given keyword and any string portion of a quote matching that keyword..
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public static string searchquote_desc {
 | 
				
			||||||
 | 
					            get {
 | 
				
			||||||
 | 
					                return ResourceManager.GetString("searchquote_desc", resourceCulture);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        ///    Looks up a localized string similar to `{0}qsearch keyword text`.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public static string searchquote_usage {
 | 
				
			||||||
 | 
					            get {
 | 
				
			||||||
 | 
					                return ResourceManager.GetString("searchquote_usage", resourceCulture);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        ///    Looks up a localized string similar to delmsgoncmd.
 | 
					        ///    Looks up a localized string similar to delmsgoncmd.
 | 
				
			||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1142,6 +1142,15 @@
 | 
				
			|||||||
  </data>
 | 
					  </data>
 | 
				
			||||||
  <data name="showquote_usage" xml:space="preserve">
 | 
					  <data name="showquote_usage" xml:space="preserve">
 | 
				
			||||||
    <value>`{0}.. abc`</value>
 | 
					    <value>`{0}.. abc`</value>
 | 
				
			||||||
 | 
					  </data>
 | 
				
			||||||
 | 
					  <data name="searchquote_cmd" xml:space="preserve">
 | 
				
			||||||
 | 
					    <value>qsearch</value>
 | 
				
			||||||
 | 
					  </data>
 | 
				
			||||||
 | 
					  <data name="searchquote_desc" xml:space="preserve">
 | 
				
			||||||
 | 
					    <value>Searches a quote for a given keyword and any string portion of a quote matching that keyword.</value>
 | 
				
			||||||
 | 
					  </data>
 | 
				
			||||||
 | 
					  <data name="searchquote_usage" xml:space="preserve">
 | 
				
			||||||
 | 
					    <value>`{0}qsearch keyword text`</value>
 | 
				
			||||||
 </data>
 | 
					 </data>
 | 
				
			||||||
  <data name="deletequote_cmd" xml:space="preserve">
 | 
					  <data name="deletequote_cmd" xml:space="preserve">
 | 
				
			||||||
    <value>deletequote delq</value>
 | 
					    <value>deletequote delq</value>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@ namespace NadekoBot.Services.Database.Repositories
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword);
 | 
					        IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword);
 | 
				
			||||||
        Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword);
 | 
					        Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword);
 | 
				
			||||||
 | 
					        Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text);
 | 
				
			||||||
        IEnumerable<Quote> GetGroup(ulong guildId, int skip, int take);
 | 
					        IEnumerable<Quote> GetGroup(ulong guildId, int skip, int take);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,5 +23,10 @@ namespace NadekoBot.Services.Database.Repositories.Impl
 | 
				
			|||||||
            var rng = new NadekoRandom();
 | 
					            var rng = new NadekoRandom();
 | 
				
			||||||
            return _set.Where(q => q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rng.Next()).FirstOrDefaultAsync();
 | 
					            return _set.Where(q => q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rng.Next()).FirstOrDefaultAsync();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        public Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text)
 | 
				
			||||||
 | 
					        {      			
 | 
				
			||||||
 | 
					            var rngk = new NadekoRandom();
 | 
				
			||||||
 | 
					            return _set.Where(q => q.Text.Contains(text) && q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rngk.Next()).FirstOrDefaultAsync();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user