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:
Kwoth
2022-01-01 08:44:51 +01:00
parent f81f9fadd3
commit 9b4eb21321
91 changed files with 1591 additions and 224 deletions

View File

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

View File

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

View File

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

View File

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