Added many more braces for multiline if's, Improved .crypto command quite a bit and applied locale-specific format

This commit is contained in:
Kwoth
2022-02-04 06:00:17 +01:00
parent f77f2f433f
commit eda38e64d1
129 changed files with 635 additions and 233 deletions

View File

@@ -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('|');

View File

@@ -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);

View File

@@ -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
{