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

@@ -65,7 +65,7 @@ namespace NadekoBot.Modules.Utility.Services
{
await Task.Yield();
if (guild == null || string.IsNullOrWhiteSpace(input))
if (guild is null || string.IsNullOrWhiteSpace(input))
return input;
if (guild != null)

View File

@@ -84,7 +84,7 @@ namespace NadekoBot.Modules.Utility.Services
data = JsonConvert.DeserializeObject<PatreonData>(res);
var pledgers = data.Data.Where(x => x["type"].ToString() == "pledge");
rewards.AddRange(pledgers.Select(x => JsonConvert.DeserializeObject<PatreonPledge>(x.ToString()))
.Where(x => x.attributes.declined_since == null));
.Where(x => x.attributes.declined_since is null));
if (data.Included != null)
{
users.AddRange(data.Included
@@ -141,7 +141,7 @@ namespace NadekoBot.Modules.Utility.Services
var users = uow.Set<RewardedUser>();
var usr = users.FirstOrDefault(x => x.PatreonUserId == data.User.id);
if (usr == null)
if (usr is null)
{
users.Add(new RewardedUser()
{

View File

@@ -156,7 +156,7 @@ namespace NadekoBot.Modules.Utility.Services
if (r.IsPrivate)
{
var user = _client.GetUser(r.ChannelId);
if (user == null)
if (user is null)
return;
ch = await user.GetOrCreateDMChannelAsync().ConfigureAwait(false);
}
@@ -164,7 +164,7 @@ namespace NadekoBot.Modules.Utility.Services
{
ch = _client.GetGuild(r.ServerId)?.GetTextChannel(r.ChannelId);
}
if (ch == null)
if (ch is null)
return;
await ch.EmbedAsync(new EmbedBuilder()

View File

@@ -165,7 +165,7 @@ where ((guildid >> 22) % {_creds.TotalShards}) == {_client.ShardId};")
return;
}
while (!(current is null) && current.Value.NextTime < rep.NextTime)
while (current is not null && current.Value.NextTime < rep.NextTime)
current = current.Next;
if (current is null)

View File

@@ -239,7 +239,7 @@ namespace NadekoBot.Modules.Utility.Services
|| a.Name.ToUpperInvariant().Contains(setting.Keyword.ToUpperInvariant())
|| setting.Whitelist.Any(x => x.UserId == user.Id)));
if (!(g is null)
if (g is not null
&& setting.Enabled
&& setting.Blacklist.All(x => x.UserId != user.Id)
&& user.RoleIds.Contains(setting.FromRoleId))
@@ -247,7 +247,7 @@ namespace NadekoBot.Modules.Utility.Services
try
{
addRole = addRole ?? user.Guild.GetRole(setting.AddRoleId);
if (addRole == null)
if (addRole is null)
{
await StopStreamRole(user.Guild).ConfigureAwait(false);
Log.Warning("Stream role in server {0} no longer exists. Stopping.", setting.AddRoleId);
@@ -278,7 +278,7 @@ namespace NadekoBot.Modules.Utility.Services
try
{
addRole = addRole ?? user.Guild.GetRole(setting.AddRoleId);
if (addRole == null)
if (addRole is null)
throw new StreamRoleNotFoundException();
await user.RemoveRoleAsync(addRole).ConfigureAwait(false);
@@ -300,7 +300,7 @@ namespace NadekoBot.Modules.Utility.Services
return;
var addRole = guild.GetRole(setting.AddRoleId);
if (addRole == null)
if (addRole is null)
return;
if (setting.Enabled)

View File

@@ -40,7 +40,7 @@ namespace NadekoBot.Modules.Utility.Services
private async Task LogVerboseError(CommandInfo cmd, ITextChannel channel, string reason)
{
if (channel == null || !guildsEnabled.Contains(channel.GuildId))
if (channel is null || !guildsEnabled.Contains(channel.GuildId))
return;
try