mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Kotz's editorconfig styles slightly modified. Target typed new usage. Brackets in expressions used for clarity.
This commit is contained in:
@@ -13,5 +13,5 @@ public class DapiImageObject : IImageData
|
||||
public string Rating { get; set; }
|
||||
|
||||
public ImageData ToCachedImageData(Booru type)
|
||||
=> new ImageData(this.FileUrl, type, this.Tags?.Split(' ') ?? this.TagString?.Split(' '), Score.ToString() ?? Rating);
|
||||
=> new(this.FileUrl, type, this.Tags?.Split(' ') ?? this.TagString?.Split(' '), Score.ToString() ?? Rating);
|
||||
}
|
@@ -8,7 +8,7 @@ public abstract class ImageDownloader<T> : IImageDownloader
|
||||
{
|
||||
protected readonly HttpClient _http;
|
||||
|
||||
protected JsonSerializerOptions _serializerOptions = new JsonSerializerOptions()
|
||||
protected JsonSerializerOptions _serializerOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
NumberHandling = JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString,
|
||||
|
@@ -9,6 +9,5 @@ public class SafebooruElement : IImageData
|
||||
public string FileUrl => $"https://safebooru.org/images/{Directory}/{Image}";
|
||||
public string Rating { get; set; }
|
||||
public string Tags { get; set; }
|
||||
public ImageData ToCachedImageData(Booru type)
|
||||
=> new ImageData(FileUrl, Booru.Safebooru, this.Tags.Split(' '), Rating);
|
||||
public ImageData ToCachedImageData(Booru type) => new(FileUrl, Booru.Safebooru, this.Tags.Split(' '), Rating);
|
||||
}
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Nsfw;
|
||||
[NoPublicBot]
|
||||
public class NSFW : NadekoModule<ISearchImagesService>
|
||||
{
|
||||
private static readonly ConcurrentHashSet<ulong> _hentaiBombBlacklist = new ConcurrentHashSet<ulong>();
|
||||
private static readonly ConcurrentHashSet<ulong> _hentaiBombBlacklist = new();
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
private readonly NadekoRandom _rng;
|
||||
|
||||
|
@@ -14,7 +14,7 @@ public record UrlReply
|
||||
public string Url { get; init; }
|
||||
public string Rating { get; init; }
|
||||
public string Provider { get; init; }
|
||||
public List<string> Tags { get; } = new List<string>();
|
||||
public List<string> Tags { get; } = new();
|
||||
}
|
||||
|
||||
public class SearchImagesService : ISearchImagesService, INService
|
||||
@@ -26,9 +26,9 @@ public class SearchImagesService : ISearchImagesService, INService
|
||||
private readonly DbService _db;
|
||||
private ConcurrentDictionary<ulong, HashSet<string>> BlacklistedTags { get; }
|
||||
|
||||
public ConcurrentDictionary<ulong, Timer> AutoHentaiTimers { get; } = new ConcurrentDictionary<ulong, Timer>();
|
||||
public ConcurrentDictionary<ulong, Timer> AutoBoobTimers { get; } = new ConcurrentDictionary<ulong, Timer>();
|
||||
public ConcurrentDictionary<ulong, Timer> AutoButtTimers { get; } = new ConcurrentDictionary<ulong, Timer>();
|
||||
public ConcurrentDictionary<ulong, Timer> AutoHentaiTimers { get; } = new();
|
||||
public ConcurrentDictionary<ulong, Timer> AutoBoobTimers { get; } = new();
|
||||
public ConcurrentDictionary<ulong, Timer> AutoButtTimers { get; } = new();
|
||||
|
||||
public SearchImagesService(DbService db,
|
||||
IHttpClientFactory http,
|
||||
@@ -219,7 +219,7 @@ public class SearchImagesService : ISearchImagesService, INService
|
||||
}
|
||||
}
|
||||
|
||||
private readonly object taglock = new object();
|
||||
private readonly object taglock = new();
|
||||
public ValueTask<bool> ToggleBlacklistTag(ulong guildId, string tag)
|
||||
{
|
||||
lock (taglock)
|
||||
|
Reference in New Issue
Block a user