mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 09:48:26 -04:00
Applied codestyle to all .cs files
This commit is contained in:
@@ -5,11 +5,15 @@ namespace NadekoBot.Modules.Permissions.Services;
|
||||
|
||||
public class GlobalPermissionService : ILateBlocker, INService
|
||||
{
|
||||
private readonly BotConfigService _bss;
|
||||
public int Priority { get; } = 0;
|
||||
|
||||
public HashSet<string> BlockedCommands => _bss.Data.Blocked.Commands;
|
||||
public HashSet<string> BlockedModules => _bss.Data.Blocked.Modules;
|
||||
public HashSet<string> BlockedCommands
|
||||
=> _bss.Data.Blocked.Commands;
|
||||
|
||||
public HashSet<string> BlockedModules
|
||||
=> _bss.Data.Blocked.Modules;
|
||||
|
||||
private readonly BotConfigService _bss;
|
||||
|
||||
public GlobalPermissionService(BotConfigService bss)
|
||||
=> _bss = bss;
|
||||
@@ -17,21 +21,19 @@ public class GlobalPermissionService : ILateBlocker, INService
|
||||
|
||||
public Task<bool> TryBlockLate(ICommandContext ctx, string moduleName, CommandInfo command)
|
||||
{
|
||||
var settings = _bss.Data;
|
||||
var settings = _bss.Data;
|
||||
var commandName = command.Name.ToLowerInvariant();
|
||||
|
||||
if (commandName != "resetglobalperms" &&
|
||||
(settings.Blocked.Commands.Contains(commandName) ||
|
||||
settings.Blocked.Modules.Contains(moduleName.ToLowerInvariant())))
|
||||
{
|
||||
if (commandName != "resetglobalperms"
|
||||
&& (settings.Blocked.Commands.Contains(commandName)
|
||||
|| settings.Blocked.Modules.Contains(moduleName.ToLowerInvariant())))
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
|
||||
return Task.FromResult(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Toggles module blacklist
|
||||
/// Toggles module blacklist
|
||||
/// </summary>
|
||||
/// <param name="moduleName">Lowercase module name</param>
|
||||
/// <returns>Whether the module is added</returns>
|
||||
@@ -53,9 +55,9 @@ public class GlobalPermissionService : ILateBlocker, INService
|
||||
|
||||
return added;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Toggles command blacklist
|
||||
/// Toggles command blacklist
|
||||
/// </summary>
|
||||
/// <param name="commandName">Lowercase command name</param>
|
||||
/// <returns>Whether the command is added</returns>
|
||||
@@ -79,7 +81,7 @@ public class GlobalPermissionService : ILateBlocker, INService
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets all global permissions
|
||||
/// Resets all global permissions
|
||||
/// </summary>
|
||||
public Task Reset()
|
||||
{
|
||||
@@ -91,4 +93,4 @@ public class GlobalPermissionService : ILateBlocker, INService
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user