mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 17:58:26 -04:00
Using pattern matching for nulls where applicable, discarded unused lambda parameters, cleaned up some classes. Unignored ServerLog commands which was mistakenly ignored due to a .gitignore rule
This commit is contained in:
@@ -40,7 +40,7 @@ public class Localization : ILocalization, INService
|
||||
|
||||
return cultureInfo;
|
||||
})
|
||||
.Where(x => x.Value != null));
|
||||
.Where(x => x.Value is not null));
|
||||
}
|
||||
|
||||
public void SetGuildCulture(IGuild guild, CultureInfo ci)
|
||||
@@ -61,7 +61,7 @@ public class Localization : ILocalization, INService
|
||||
uow.SaveChanges();
|
||||
}
|
||||
|
||||
GuildCultureInfos.AddOrUpdate(guildId, ci, (id, old) => ci);
|
||||
GuildCultureInfos.AddOrUpdate(guildId, ci, (_, _) => ci);
|
||||
}
|
||||
|
||||
public void RemoveGuildCulture(IGuild guild)
|
||||
|
@@ -38,7 +38,7 @@ public class RedisCache : IDataCache
|
||||
{
|
||||
var _db = Redis.GetDatabase();
|
||||
byte[] x = await _db.StringGetAsync("image_" + key);
|
||||
return (x != null, x);
|
||||
return (x is not null, x);
|
||||
}
|
||||
|
||||
public Task SetImageDataAsync(Uri key, byte[] data)
|
||||
@@ -51,7 +51,7 @@ public class RedisCache : IDataCache
|
||||
{
|
||||
var _db = Redis.GetDatabase();
|
||||
string x = await _db.StringGetAsync("anime_" + key);
|
||||
return (x != null, x);
|
||||
return (x is not null, x);
|
||||
}
|
||||
|
||||
public Task SetAnimeDataAsync(string key, string data)
|
||||
@@ -64,7 +64,7 @@ public class RedisCache : IDataCache
|
||||
{
|
||||
var _db = Redis.GetDatabase();
|
||||
string x = await _db.StringGetAsync("novel_" + key);
|
||||
return (x != null, x);
|
||||
return (x is not null, x);
|
||||
}
|
||||
|
||||
public Task SetNovelDataAsync(string key, string data)
|
||||
@@ -156,7 +156,7 @@ public class RedisCache : IDataCache
|
||||
public bool TryGetEconomy(out string data)
|
||||
{
|
||||
var _db = Redis.GetDatabase();
|
||||
if ((data = _db.StringGet($"{_redisKey}_economy")) != null) return true;
|
||||
if ((data = _db.StringGet($"{_redisKey}_economy")) is not null) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@@ -132,7 +132,7 @@ public class StatsService : IStatsService, IReadyExecutor, INService, IDisposabl
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
|
||||
_botlistTimer = new(async state =>
|
||||
_botlistTimer = new(async _ =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_creds.BotListToken))
|
||||
return;
|
||||
|
@@ -67,7 +67,7 @@ public class YtdlOperation
|
||||
process.Start();
|
||||
|
||||
string line;
|
||||
while ((line = await process.StandardOutput.ReadLineAsync()) != null)
|
||||
while ((line = await process.StandardOutput.ReadLineAsync()) is not null)
|
||||
yield return line;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user