mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Changed all == null to is null and all !(* == null) to * is not null
This commit is contained in:
@@ -28,7 +28,7 @@ namespace NadekoBot.Db
|
||||
.Include(y => y.StreamRole.Whitelist)
|
||||
.Include(y => y.StreamRole.Blacklist));
|
||||
|
||||
if (conf.StreamRole == null)
|
||||
if (conf.StreamRole is null)
|
||||
conf.StreamRole = new StreamRoleSettings();
|
||||
|
||||
return conf.StreamRole;
|
||||
@@ -79,7 +79,7 @@ namespace NadekoBot.Db
|
||||
{
|
||||
GuildConfig config;
|
||||
|
||||
if (includes == null)
|
||||
if (includes is null)
|
||||
{
|
||||
config = ctx
|
||||
.GuildConfigs
|
||||
@@ -92,7 +92,7 @@ namespace NadekoBot.Db
|
||||
config = set.FirstOrDefault(c => c.GuildId == guildId);
|
||||
}
|
||||
|
||||
if (config == null)
|
||||
if (config is null)
|
||||
{
|
||||
ctx.GuildConfigs.Add((config = new GuildConfig
|
||||
{
|
||||
@@ -122,7 +122,7 @@ namespace NadekoBot.Db
|
||||
.ThenInclude(gc => gc.IgnoredChannels)
|
||||
.FirstOrDefault(x => x.GuildId == guildId);
|
||||
|
||||
if (config == null)
|
||||
if (config is null)
|
||||
{
|
||||
ctx.GuildConfigs.Add((config = new GuildConfig
|
||||
{
|
||||
@@ -160,7 +160,7 @@ namespace NadekoBot.Db
|
||||
.Include(gc => gc.Permissions)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (config == null) // if there is no guildconfig, create new one
|
||||
if (config is null) // if there is no guildconfig, create new one
|
||||
{
|
||||
ctx.GuildConfigs.Add((config = new GuildConfig
|
||||
{
|
||||
@@ -169,7 +169,7 @@ namespace NadekoBot.Db
|
||||
}));
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
else if (config.Permissions == null || !config.Permissions.Any()) // if no perms, add default ones
|
||||
else if (config.Permissions is null || !config.Permissions.Any()) // if no perms, add default ones
|
||||
{
|
||||
config.Permissions = Permissionv2.GetDefaultPermlist;
|
||||
ctx.SaveChanges();
|
||||
@@ -200,7 +200,7 @@ namespace NadekoBot.Db
|
||||
{
|
||||
var conf = configs.FirstOrDefault(gc => gc.GuildId == id);
|
||||
|
||||
if (conf == null)
|
||||
if (conf is null)
|
||||
return;
|
||||
|
||||
conf.CleverbotEnabled = cleverbotEnabled;
|
||||
@@ -216,7 +216,7 @@ namespace NadekoBot.Db
|
||||
.Include(x => x.XpSettings)
|
||||
.ThenInclude(x => x.ExclusionList));
|
||||
|
||||
if (gc.XpSettings == null)
|
||||
if (gc.XpSettings is null)
|
||||
gc.XpSettings = new XpSettings();
|
||||
|
||||
return gc.XpSettings;
|
||||
|
@@ -11,7 +11,7 @@ namespace NadekoBot.Db
|
||||
{
|
||||
var role = roles.FirstOrDefault(s => s.GuildId == guildId && s.RoleId == roleId);
|
||||
|
||||
if (role == null)
|
||||
if (role is null)
|
||||
return false;
|
||||
|
||||
roles.Remove(role);
|
||||
|
@@ -13,7 +13,7 @@ namespace NadekoBot.Db
|
||||
{
|
||||
var usr = ctx.UserXpStats.FirstOrDefault(x => x.UserId == userId && x.GuildId == guildId);
|
||||
|
||||
if (usr == null)
|
||||
if (usr is null)
|
||||
{
|
||||
ctx.Add(usr = new UserXpStats()
|
||||
{
|
||||
|
@@ -28,7 +28,7 @@ namespace NadekoBot.Db
|
||||
{
|
||||
public static WaifuInfo ByWaifuUserId(this DbSet<WaifuInfo> waifus, ulong userId, Func<DbSet<WaifuInfo>, IQueryable<WaifuInfo>> includes = null)
|
||||
{
|
||||
if (includes == null)
|
||||
if (includes is null)
|
||||
{
|
||||
return waifus.Include(wi => wi.Waifu)
|
||||
.Include(wi => wi.Affinity)
|
||||
|
@@ -27,7 +27,7 @@ namespace NadekoBot.Db
|
||||
.Skip(index)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (warn == null || warn.Forgiven)
|
||||
if (warn is null || warn.Forgiven)
|
||||
return false;
|
||||
|
||||
warn.Forgiven = true;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
//// override object.Equals
|
||||
//public override bool Equals(object obj)
|
||||
//{
|
||||
// if (obj == null || GetType() != obj.GetType())
|
||||
// if (obj is null || GetType() != obj.GetType())
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
@@ -33,7 +33,7 @@ namespace NadekoBot.Core.Services.Database.Models
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
if (obj is null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
// override object.Equals
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
if (obj is null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
// override object.Equals
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
if (obj is null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ namespace NadekoBot.Core.Services.Database.Models
|
||||
{
|
||||
claimer = $"{ claimerUsername }#{Claimer.Discriminator}";
|
||||
}
|
||||
if (AffinityId == null)
|
||||
if (AffinityId is null)
|
||||
{
|
||||
status = $"... but {waifuUsername}'s heart is empty";
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace NadekoBot.Core.Services.Database.Models
|
||||
{
|
||||
claimer = $"{ claimerUsername }#{ClaimerDiscrim}";
|
||||
}
|
||||
if (Affinity == null)
|
||||
if (Affinity is null)
|
||||
{
|
||||
status = $"... but {waifuUsername}'s heart is empty";
|
||||
}
|
||||
|
Reference in New Issue
Block a user