mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Changed all == null to is null and all !(* == null) to * is not null
This commit is contained in:
@@ -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()
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -61,7 +61,7 @@ namespace NadekoBot.Modules.Games
|
||||
var gr = _service.GirlRatings.GetOrAdd(usr.Id, GetGirl);
|
||||
var originalStream = await gr.Stream;
|
||||
|
||||
if (originalStream == null)
|
||||
if (originalStream is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("something_went_wrong").ConfigureAwait(false);
|
||||
return;
|
||||
|
@@ -85,7 +85,7 @@ namespace NadekoBot.Modules.Games
|
||||
|
||||
Task Hm_OnGameEnded(Hangman game, string winner)
|
||||
{
|
||||
if (winner == null)
|
||||
if (winner is null)
|
||||
{
|
||||
var loseEmbed = new EmbedBuilder().WithTitle($"Hangman Game ({game.TermType}) - Ended")
|
||||
.WithDescription(Format.Bold("You lose."))
|
||||
|
@@ -89,7 +89,7 @@ namespace NadekoBot.Modules.Games
|
||||
game.Dispose();
|
||||
}
|
||||
|
||||
if (arg2 == null)
|
||||
if (arg2 is null)
|
||||
return ConfirmLocalizedAsync("nunchi_ended_no_winner", Format.Bold(arg2));
|
||||
else
|
||||
return ConfirmLocalizedAsync("nunchi_ended", Format.Bold(arg2));
|
||||
|
@@ -33,7 +33,7 @@ namespace NadekoBot.Modules.Games
|
||||
|
||||
var poll = _service.CreatePoll(ctx.Guild.Id,
|
||||
ctx.Channel.Id, arg);
|
||||
if(poll == null)
|
||||
if(poll is null)
|
||||
{
|
||||
await ReplyErrorLocalizedAsync("poll_invalid_input").ConfigureAwait(false);
|
||||
return;
|
||||
@@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Games
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
Poll p;
|
||||
if ((p = _service.StopPoll(ctx.Guild.Id)) == null)
|
||||
if ((p = _service.StopPoll(ctx.Guild.Id)) is null)
|
||||
return;
|
||||
|
||||
var embed = GetStats(p, GetText("poll_closed"));
|
||||
|
@@ -59,7 +59,7 @@ namespace NadekoBot.Modules.Games.Services
|
||||
var channel = msg.Channel as ITextChannel;
|
||||
cleverbot = null;
|
||||
|
||||
if (channel == null)
|
||||
if (channel is null)
|
||||
return null;
|
||||
|
||||
if (!ChatterBotGuilds.TryGetValue(channel.Guild.Id, out Lazy<IChatterBotSession> lazyCleverbot))
|
||||
@@ -110,7 +110,7 @@ namespace NadekoBot.Modules.Games.Services
|
||||
try
|
||||
{
|
||||
var message = PrepareMessage(usrMsg, out IChatterBotSession cbs);
|
||||
if (message == null || cbs == null)
|
||||
if (message is null || cbs is null)
|
||||
return false;
|
||||
|
||||
var pc = _perms.GetCacheFor(guild.Id);
|
||||
|
@@ -108,7 +108,7 @@ namespace NadekoBot.Modules.Games.Services
|
||||
|
||||
public async Task<bool> RunBehavior(DiscordSocketClient client, IGuild guild, IUserMessage msg)
|
||||
{
|
||||
if (guild == null)
|
||||
if (guild is null)
|
||||
return false;
|
||||
|
||||
if (!ActivePolls.TryGetValue(guild.Id, out var poll))
|
||||
|
Reference in New Issue
Block a user