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:
@@ -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();
|
||||
|
@@ -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();
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ public class WaifuInfo : DbEntity
|
||||
var waifuUsername = Waifu.Username.TrimTo(20);
|
||||
var claimerUsername = Claimer?.Username.TrimTo(20);
|
||||
|
||||
if (ClaimerId != null) claimer = $"{claimerUsername}#{Claimer.Discriminator}";
|
||||
if (ClaimerId is not null) claimer = $"{claimerUsername}#{Claimer.Discriminator}";
|
||||
if (AffinityId is null)
|
||||
status = $"... but {waifuUsername}'s heart is empty";
|
||||
else if (AffinityId == ClaimerId)
|
||||
@@ -58,7 +58,7 @@ public class WaifuLbResult
|
||||
var waifuUsername = Username.TrimTo(20);
|
||||
var claimerUsername = Claimer?.TrimTo(20);
|
||||
|
||||
if (Claimer != null) claimer = $"{claimerUsername}#{ClaimerDiscrim}";
|
||||
if (Claimer is not null) claimer = $"{claimerUsername}#{ClaimerDiscrim}";
|
||||
if (Affinity is null)
|
||||
status = $"... but {waifuUsername}'s heart is empty";
|
||||
else if (Affinity + AffinityDiscrim == Claimer + ClaimerDiscrim)
|
||||
|
Reference in New Issue
Block a user