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

@@ -17,13 +17,13 @@ public static class PollExtensions
if (p is null)
return;
if (p.Votes != null)
if (p.Votes is not null)
{
ctx.RemoveRange(p.Votes);
p.Votes.Clear();
}
if (p.Answers != null)
if (p.Answers is not null)
{
ctx.RemoveRange(p.Answers);
p.Answers.Clear();

View File

@@ -31,7 +31,7 @@ public static class QuoteExtensions
{
var rng = new NadekoRandom();
return (await quotes.AsQueryable().Where(q => q.GuildId == guildId && q.Keyword == keyword).ToListAsync())
.OrderBy(q => rng.Next())
.OrderBy(_ => rng.Next())
.FirstOrDefault();
}
@@ -48,7 +48,7 @@ public static class QuoteExtensions
&& EF.Functions.Like(q.Text.ToUpper(), $"%{text.ToUpper()}%")
// && q.Text.Contains(text, StringComparison.OrdinalIgnoreCase)
)
.ToListAsync()).OrderBy(q => rngk.Next())
.ToListAsync()).OrderBy(_ => rngk.Next())
.FirstOrDefault();
}