Changed all == null to is null and all !(* == null) to * is not null

This commit is contained in:
Kwoth
2021-06-19 08:24:09 +02:00
parent 81406cb46a
commit d8c7cdc7f4
125 changed files with 367 additions and 366 deletions

View File

@@ -345,7 +345,7 @@ namespace NadekoBot.Modules.Gambling.Common.Blackjack
public Task PrintState()
{
if (StateUpdated == null)
if (StateUpdated is null)
return Task.CompletedTask;
return StateUpdated.Invoke(this);
}

View File

@@ -300,7 +300,7 @@ namespace NadekoBot.Modules.Gambling.Common
public static string GetHandValue(List<Card> cards)
{
if (handValues == null)
if (handValues is null)
InitHandValues();
foreach (var kvp in handValues.Where(x => x.Value(cards)))
{

View File

@@ -169,12 +169,12 @@ namespace NadekoBot.Modules.Gambling.Common.Events
if (_emote.Name != r.Emote.Name)
return;
var gu = (r.User.IsSpecified ? r.User.Value : null) as IGuildUser;
if (gu == null // no unknown users, as they could be bots, or alts
if (gu is null // no unknown users, as they could be bots, or alts
|| msg.Id != _msg.Id // same message
|| gu.IsBot // no bots
|| (DateTime.UtcNow - gu.CreatedAt).TotalDays <= 5 // no recently created accounts
|| (_noRecentlyJoinedServer && // if specified, no users who joined the server in the last 24h
(gu.JoinedAt == null || (DateTime.UtcNow - gu.JoinedAt.Value).TotalDays < 1))) // and no users for who we don't know when they joined
(gu.JoinedAt is null || (DateTime.UtcNow - gu.JoinedAt.Value).TotalDays < 1))) // and no users for who we don't know when they joined
{
return;
}