mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04:00
Kotz's editorconfig styles slightly modified. Target typed new usage. Brackets in expressions used for clarity.
This commit is contained in:
@@ -53,7 +53,7 @@ public class CryptoService : INService
|
||||
return (crypto, null);
|
||||
}
|
||||
|
||||
private readonly SemaphoreSlim getCryptoLock = new SemaphoreSlim(1, 1);
|
||||
private readonly SemaphoreSlim getCryptoLock = new(1, 1);
|
||||
public async Task<List<CryptoResponseData>> CryptoData()
|
||||
{
|
||||
await getCryptoLock.WaitAsync();
|
||||
|
@@ -12,8 +12,7 @@ public class FeedsService : INService
|
||||
private readonly DiscordSocketClient _client;
|
||||
private readonly IEmbedBuilderService _eb;
|
||||
|
||||
private readonly ConcurrentDictionary<string, DateTime> _lastPosts =
|
||||
new ConcurrentDictionary<string, DateTime>();
|
||||
private readonly ConcurrentDictionary<string, DateTime> _lastPosts = new();
|
||||
|
||||
public FeedsService(Bot bot, DbService db, DiscordSocketClient client, IEmbedBuilderService eb)
|
||||
{
|
||||
@@ -59,7 +58,7 @@ public class FeedsService : INService
|
||||
.Select(item => (Item: item, LastUpdate: item.PublishingDate?.ToUniversalTime()
|
||||
?? (item.SpecificItem as AtomFeedItem)?.UpdatedDate
|
||||
?.ToUniversalTime()))
|
||||
.Where(data => !(data.LastUpdate is null))
|
||||
.Where(data => data.LastUpdate is not null)
|
||||
.Select(data => (data.Item, LastUpdate: (DateTime) data.LastUpdate))
|
||||
.OrderByDescending(data => data.LastUpdate)
|
||||
.Reverse() // start from the oldest
|
||||
|
@@ -23,8 +23,8 @@ public class SearchesService : INService
|
||||
private readonly IBotCredentials _creds;
|
||||
private readonly NadekoRandom _rng;
|
||||
|
||||
public List<WoWJoke> WowJokes { get; } = new List<WoWJoke>();
|
||||
public List<MagicItem> MagicItems { get; } = new List<MagicItem>();
|
||||
public List<WoWJoke> WowJokes { get; } = new();
|
||||
public List<MagicItem> MagicItems { get; } = new();
|
||||
private readonly List<string> _yomamaJokes;
|
||||
|
||||
public SearchesService(IGoogleApiService google,
|
||||
@@ -282,7 +282,7 @@ public class SearchesService : INService
|
||||
_rng.Next(1, max).ToString("000") + ".png";
|
||||
}
|
||||
|
||||
private readonly object yomamaLock = new object();
|
||||
private readonly object yomamaLock = new();
|
||||
private int yomamaJokeIndex = 0;
|
||||
public Task<string> GetYomamaJoke()
|
||||
{
|
||||
@@ -567,7 +567,7 @@ public class SearchesService : INService
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly HtmlParser _googleParser = new HtmlParser(new()
|
||||
private static readonly HtmlParser _googleParser = new(new()
|
||||
{
|
||||
IsScripting = false,
|
||||
IsEmbedded = false,
|
||||
|
@@ -17,10 +17,9 @@ public sealed class StreamNotificationService : INService
|
||||
private readonly DiscordSocketClient _client;
|
||||
private readonly NotifChecker _streamTracker;
|
||||
|
||||
private readonly object _shardLock = new object();
|
||||
private readonly object _shardLock = new();
|
||||
|
||||
private readonly Dictionary<StreamDataKey, HashSet<ulong>> _trackCounter =
|
||||
new Dictionary<StreamDataKey, HashSet<ulong>>();
|
||||
private readonly Dictionary<StreamDataKey, HashSet<ulong>> _trackCounter = new();
|
||||
|
||||
private readonly Dictionary<StreamDataKey, Dictionary<ulong, HashSet<FollowedStream>>> _shardTrackedStreams;
|
||||
private readonly ConcurrentHashSet<ulong> _offlineNotificationServers;
|
||||
|
Reference in New Issue
Block a user