mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Re-added .google search result scraper and set it as the default again. Also added versioning to searches.yml as it was forgotten previously
This commit is contained in:
@@ -6,13 +6,17 @@ namespace NadekoBot.Modules.Searches;
|
||||
[Cloneable]
|
||||
public partial class SearchesConfig : ICloneable<SearchesConfig>
|
||||
{
|
||||
[Comment("DO NOT CHANGE")]
|
||||
public int Version { get; set; } = 0;
|
||||
|
||||
[Comment(@"Which engine should .search command
|
||||
'google' requires googleApiKey and google.searchId set in creds.yml
|
||||
'searx' requires at least one searx instance specified in the 'searxInstances' property below")]
|
||||
public WebSearchEngine WebSearchEngine { get; set; } = WebSearchEngine.Google;
|
||||
'google_scrape' - default. Scrapes the webpage for results. May break. Requires no api keys.
|
||||
'google' - official google api. Requires googleApiKey and google.searchId set in creds.yml
|
||||
'searx' - requires at least one searx instance specified in the 'searxInstances' property below")]
|
||||
public WebSearchEngine WebSearchEngine { get; set; } = WebSearchEngine.Google_Scrape;
|
||||
|
||||
[Comment(@"Which engine should .image command use
|
||||
'google' requires googleApiKey and google.imageSearchId set in creds.yml
|
||||
'google'- official google api. googleApiKey and google.imageSearchId set in creds.yml
|
||||
'searx' requires at least one searx instance specified in the 'searxInstances' property below")]
|
||||
public ImgSearchEngine ImgSearchEngine { get; set; } = ImgSearchEngine.Google;
|
||||
|
||||
|
@@ -27,5 +27,19 @@ public class SearchesConfigService : ConfigServiceBase<SearchesConfig>
|
||||
sc => sc.YtProvider,
|
||||
ConfigParsers.InsensitiveEnum,
|
||||
ConfigPrinters.ToString);
|
||||
|
||||
Migrate();
|
||||
}
|
||||
|
||||
private void Migrate()
|
||||
{
|
||||
if (data.Version < 1)
|
||||
{
|
||||
ModifyConfig(c =>
|
||||
{
|
||||
c.Version = 1;
|
||||
c.WebSearchEngine = WebSearchEngine.Google_Scrape;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,9 @@
|
||||
namespace NadekoBot.Modules.Searches;
|
||||
// ReSharper disable InconsistentNaming
|
||||
namespace NadekoBot.Modules.Searches;
|
||||
|
||||
public enum WebSearchEngine
|
||||
{
|
||||
Google,
|
||||
Google_Scrape,
|
||||
Searx,
|
||||
}
|
Reference in New Issue
Block a user