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

@@ -32,7 +32,7 @@ namespace NadekoBot.Modules.Games.Common
{
// has to be a user message
// channel must be the same the poll started in
if (msg == null || msg.Author.IsBot || msg.Channel.Id != Poll.ChannelId)
if (msg is null || msg.Author.IsBot || msg.Channel.Id != Poll.ChannelId)
return false;
// has to be an integer
@@ -43,7 +43,7 @@ namespace NadekoBot.Modules.Games.Common
return false;
var usr = msg.Author as IGuildUser;
if (usr == null)
if (usr is null)
return false;
voteObj = new PollVote()

View File

@@ -81,7 +81,7 @@ namespace NadekoBot.Modules.Games.Common
{
for (var j = 0; j < _state.GetLength(1); j++)
{
sb.Append(_state[i, j] == null ? _numbers[i * 3 + j] : GetIcon(_state[i, j]));
sb.Append(_state[i, j] is null ? _numbers[i * 3 + j] : GetIcon(_state[i, j]));
if (j < _state.GetLength(1) - 1)
sb.Append("┃");
}
@@ -102,7 +102,7 @@ namespace NadekoBot.Modules.Games.Common
if (!string.IsNullOrWhiteSpace(title))
embed.WithTitle(title);
if (_winner == null)
if (_winner is null)
{
if (_phase == Phase.Ended)
embed.WithFooter(efb => efb.WithText(GetText("ttt_no_moves")));
@@ -192,7 +192,7 @@ namespace NadekoBot.Modules.Games.Common
{
for (var j = 0; j < 3; j++)
{
if (_state[i, j] == null)
if (_state[i, j] is null)
return false;
}
}
@@ -213,7 +213,7 @@ namespace NadekoBot.Modules.Games.Common
if (int.TryParse(msg.Content, out var index) &&
--index >= 0 &&
index <= 9 &&
_state[index / 3, index % 3] == null)
_state[index / 3, index % 3] is null)
{
_state[index / 3, index % 3] = _curUserIndex;

View File

@@ -210,7 +210,7 @@ namespace NadekoBot.Modules.Games.Common.Trivia
var umsg = imsg as SocketUserMessage;
var textChannel = umsg?.Channel as ITextChannel;
if (textChannel == null || textChannel.Guild != Guild)
if (textChannel is null || textChannel.Guild != Guild)
return;
var guildUser = (IGuildUser)umsg.Author;

View File

@@ -143,10 +143,10 @@ namespace NadekoBot.Modules.Games.Common
if (imsg.Author.IsBot)
return;
var msg = imsg as SocketUserMessage;
if (msg == null)
if (msg is null)
return;
if (this.Channel == null || this.Channel.Id != msg.Channel.Id) return;
if (this.Channel is null || this.Channel.Id != msg.Channel.Id) return;
var guess = msg.Content;