Using pattern matching for nulls where applicable, discarded unused lambda parameters, cleaned up some classes. Unignored ServerLog commands which was mistakenly ignored due to a .gitignore rule

This commit is contained in:
Kwoth
2022-01-01 08:44:51 +01:00
parent f81f9fadd3
commit 9b4eb21321
91 changed files with 1591 additions and 224 deletions

View File

@@ -46,7 +46,7 @@ public partial class Administration
var emote = x.Last().ToIEmote();
return new { role, emote };
})
.Where(x => x != null)
.Where(x => x is not null)
.WhenAll();
if (!all.Any())

View File

@@ -54,7 +54,7 @@ public class RoleCommandsService : INService
var reactionRole = conf.ReactionRoles.FirstOrDefault(x
=> x.EmoteName == reaction.Emote.Name || x.EmoteName == reaction.Emote.ToString());
if (reactionRole != null)
if (reactionRole is not null)
{
if (!conf.Exclusive)
{
@@ -125,7 +125,7 @@ public class RoleCommandsService : INService
var reactionRole = conf.ReactionRoles.FirstOrDefault(x
=> x.EmoteName == reaction.Emote.Name || x.EmoteName == reaction.Emote.ToString());
if (reactionRole != null)
if (reactionRole is not null)
{
var role = gusr.Guild.GetRole(reactionRole.RoleId);
if (role is null)
@@ -181,7 +181,7 @@ public class RoleCommandsService : INService
{
var toAdd = user.Guild.GetRole(dbRero.RoleId);
return toAdd != null && !user.Roles.Contains(toAdd) ? user.AddRoleAsync(toAdd) : Task.CompletedTask;
return toAdd is not null && !user.Roles.Contains(toAdd) ? user.AddRoleAsync(toAdd) : Task.CompletedTask;
}
/// <summary>
@@ -208,7 +208,7 @@ public class RoleCommandsService : INService
var roleIds = dbReroMsg.ReactionRoles.Select(x => x.RoleId)
.Where(x => x != dbRero.RoleId)
.Select(x => user.Guild.GetRole(x))
.Where(x => x != null);
.Where(x => x is not null);
var removeReactionsTask = RemoveOldReactionsAsync(reactionMessage, user, reaction, cToken);