backport of public nsfw module

This commit is contained in:
Kwoth
2021-10-21 23:35:58 +00:00
parent 24a4745193
commit 1141791ce5
44 changed files with 4284 additions and 713 deletions

View File

@@ -22,6 +22,7 @@ using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using NadekoBot.Modules.Administration.Services;
using NadekoBot.Modules.Nsfw.Common;
using Serilog;
using Configuration = AngleSharp.Configuration;
@@ -589,10 +590,6 @@ namespace NadekoBot.Modules.Searches
await SendConfirmAsync($"https://images.google.com/searchbyimage?image_url={imageLink}").ConfigureAwait(false);
}
[NadekoCommand, Aliases]
public Task Safebooru([Leftover] string tag = null)
=> InternalDapiCommand(tag, DapiSearchType.Safebooru);
[NadekoCommand, Aliases]
public async Task Wiki([Leftover] string query = null)
{
@@ -760,21 +757,6 @@ namespace NadekoBot.Modules.Searches
await ctx.Channel.SendMessageAsync($"https://store.steampowered.com/app/{appId}").ConfigureAwait(false);
}
public async Task InternalDapiCommand(string tag, DapiSearchType type)
{
tag = tag?.Trim() ?? "";
var imgObj = await _service.DapiSearch(tag, type, ctx.Guild?.Id).ConfigureAwait(false);
if (imgObj is null)
await SendErrorAsync(ctx.User.Mention + " " + GetText(strs.no_results)).ConfigureAwait(false);
else
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
.WithDescription($"{ctx.User.Mention} [{tag ?? "url"}]({imgObj.FileUrl})")
.WithImageUrl(imgObj.FileUrl)
.WithFooter(type.ToString())).ConfigureAwait(false);
}
public async Task<bool> ValidateQuery(IMessageChannel ch, string query)
{
if (!string.IsNullOrWhiteSpace(query))