mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
NadekoBot Patronage system, Search commands improvements + fixes
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using NadekoBot.Modules.Searches.Youtube;
|
||||
|
||||
namespace NadekoBot.Modules.Searches;
|
||||
|
||||
public sealed class DefaultSearchServiceFactory : ISearchServiceFactory, INService
|
||||
{
|
||||
private readonly SearchesConfigService _scs;
|
||||
private readonly SearxSearchService _sss;
|
||||
private readonly GoogleSearchService _gss;
|
||||
|
||||
private readonly YtdlpYoutubeSearchService _ytdlp;
|
||||
private readonly YtdlYoutubeSearchService _ytdl;
|
||||
private readonly YoutubeDataApiSearchService _ytdata;
|
||||
private readonly InvidiousYtSearchService _iYtSs;
|
||||
|
||||
public DefaultSearchServiceFactory(
|
||||
SearchesConfigService scs,
|
||||
GoogleSearchService gss,
|
||||
SearxSearchService sss,
|
||||
YtdlpYoutubeSearchService ytdlp,
|
||||
YtdlYoutubeSearchService ytdl,
|
||||
YoutubeDataApiSearchService ytdata,
|
||||
InvidiousYtSearchService iYtSs)
|
||||
{
|
||||
_scs = scs;
|
||||
_sss = sss;
|
||||
_gss = gss;
|
||||
_iYtSs = iYtSs;
|
||||
|
||||
_ytdlp = ytdlp;
|
||||
_ytdl = ytdl;
|
||||
_ytdata = ytdata;
|
||||
}
|
||||
|
||||
public ISearchService GetSearchService(string? hint = null)
|
||||
=> _scs.Data.WebSearchEngine switch
|
||||
{
|
||||
WebSearchEngine.Google => _gss,
|
||||
WebSearchEngine.Searx => _sss,
|
||||
_ => _gss
|
||||
};
|
||||
|
||||
public ISearchService GetImageSearchService(string? hint = null)
|
||||
=> _scs.Data.ImgSearchEngine switch
|
||||
{
|
||||
ImgSearchEngine.Google => _gss,
|
||||
ImgSearchEngine.Searx => _sss,
|
||||
_ => _gss
|
||||
};
|
||||
|
||||
public IYoutubeSearchService GetYoutubeSearchService(string? hint = null)
|
||||
=> _scs.Data.YtProvider switch
|
||||
{
|
||||
YoutubeSearcher.YtDataApiv3 => _ytdata,
|
||||
YoutubeSearcher.Ytdlp => _ytdlp,
|
||||
YoutubeSearcher.Ytdl => _ytdl,
|
||||
YoutubeSearcher.Invidious => _iYtSs,
|
||||
_ => _ytdl
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user