mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Added many more braces for multiline if's, Improved .crypto command quite a bit and applied locale-specific format
This commit is contained in:
@@ -81,9 +81,7 @@ public partial class NSFW : NadekoModule<ISearchImagesService>
|
||||
try
|
||||
{
|
||||
if (tags is null || tags.Length == 0)
|
||||
{
|
||||
await InternalDapiCommand(null, true, _service.Hentai);
|
||||
}
|
||||
else
|
||||
{
|
||||
var groups = tags.Split('|');
|
||||
|
@@ -245,9 +245,7 @@ public class SearchImageCacher : INService
|
||||
page = _rng.Next(0, maxPage);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = _rng.Next(0, 11);
|
||||
}
|
||||
|
||||
var result = await DownloadImagesAsync(tags, isExplicit, type, page, cancel);
|
||||
|
||||
|
@@ -75,11 +75,13 @@ public class SearchImagesService : ISearchImagesService, INService
|
||||
CancellationToken cancel)
|
||||
{
|
||||
if (!tags.All(x => IsValidTag(x)))
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Error = "One or more tags are invalid.",
|
||||
Url = ""
|
||||
};
|
||||
}
|
||||
|
||||
Log.Information("Getting {V} image for Guild: {GuildId}...", dapi.ToString(), guildId);
|
||||
try
|
||||
@@ -87,27 +89,33 @@ public class SearchImagesService : ISearchImagesService, INService
|
||||
BlacklistedTags.TryGetValue(guildId, out var blTags);
|
||||
|
||||
if (dapi == Booru.E621)
|
||||
{
|
||||
for (var i = 0; i < tags.Length; ++i)
|
||||
{
|
||||
if (tags[i] == "yuri")
|
||||
tags[i] = "female/female";
|
||||
}
|
||||
}
|
||||
|
||||
if (dapi == Booru.Derpibooru)
|
||||
{
|
||||
for (var i = 0; i < tags.Length; ++i)
|
||||
{
|
||||
if (tags[i] == "yuri")
|
||||
tags[i] = "lesbian";
|
||||
}
|
||||
}
|
||||
|
||||
var result = await _cache.GetImageNew(tags, forceExplicit, dapi, blTags ?? new HashSet<string>(), cancel);
|
||||
|
||||
if (result is null)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Error = "Image not found.",
|
||||
Url = ""
|
||||
};
|
||||
}
|
||||
|
||||
var reply = new UrlReply
|
||||
{
|
||||
|
Reference in New Issue
Block a user