mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04:00
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:
@@ -45,7 +45,7 @@ public partial class Permissions
|
||||
var localSet = CommandCooldowns.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<CommandCooldown>());
|
||||
|
||||
var toDelete = config.CommandCooldowns.FirstOrDefault(cc => cc.CommandName == name);
|
||||
if (toDelete != null)
|
||||
if (toDelete is not null)
|
||||
uow.Set<CommandCooldown>().Remove(toDelete);
|
||||
localSet.RemoveWhere(cc => cc.CommandName == name);
|
||||
if (secs != 0)
|
||||
|
@@ -42,7 +42,7 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
[Priority(0)]
|
||||
public async partial Task PermRole([Leftover] IRole role = null)
|
||||
{
|
||||
if (role != null && role == role.Guild.EveryoneRole)
|
||||
if (role is not null && role == role.Guild.EveryoneRole)
|
||||
return;
|
||||
|
||||
if (role is null)
|
||||
|
@@ -38,7 +38,7 @@ public sealed class BlacklistService : IEarlyBehavior
|
||||
{
|
||||
foreach (var bl in _blacklist)
|
||||
{
|
||||
if (guild != null && bl.Type == BlacklistType.Server && bl.ItemId == guild.Id)
|
||||
if (guild is not null && bl.Type == BlacklistType.Server && bl.ItemId == guild.Id)
|
||||
{
|
||||
Log.Information("Blocked input from blacklisted guild: {GuildName} [{GuildId}]", guild.Name, guild.Id);
|
||||
|
||||
|
@@ -22,10 +22,10 @@ public class CmdCdService : ILateBlocker, INService
|
||||
|
||||
var cmdcds = CommandCooldowns.GetOrAdd(guild.Id, new ConcurrentHashSet<CommandCooldown>());
|
||||
CommandCooldown cdRule;
|
||||
if ((cdRule = cmdcds.FirstOrDefault(cc => cc.CommandName == commandName)) != null)
|
||||
if ((cdRule = cmdcds.FirstOrDefault(cc => cc.CommandName == commandName)) is not null)
|
||||
{
|
||||
var activeCdsForGuild = ActiveCooldowns.GetOrAdd(guild.Id, new ConcurrentHashSet<ActiveCooldown>());
|
||||
if (activeCdsForGuild.FirstOrDefault(ac => ac.UserId == user.Id && ac.Command == commandName) != null)
|
||||
if (activeCdsForGuild.FirstOrDefault(ac => ac.UserId == user.Id && ac.Command == commandName) is not null)
|
||||
return Task.FromResult(true);
|
||||
|
||||
activeCdsForGuild.Add(new() { UserId = user.Id, Command = commandName });
|
||||
|
@@ -82,7 +82,7 @@ public class PermissionService : ILateBlocker, INService
|
||||
PermRole = config.PermissionRole,
|
||||
Verbose = config.VerbosePermissions
|
||||
},
|
||||
(id, old) =>
|
||||
(_, old) =>
|
||||
{
|
||||
old.Permissions = new(config.Permissions);
|
||||
old.PermRole = config.PermissionRole;
|
||||
|
Reference in New Issue
Block a user