mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
- Started cleanup of command handler
- Removed IUnloadableService - Started removing INService (removed it from services which implement behavior interfaces) - wip - Added scrutor for better service registration - wip
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Discord;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Common.ModuleBehaviors;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
@@ -12,7 +11,7 @@ using NadekoBot.Db;
|
||||
|
||||
namespace NadekoBot.Modules.Permissions.Services
|
||||
{
|
||||
public sealed class BlacklistService : IEarlyBehavior, INService
|
||||
public sealed class BlacklistService : IEarlyBehavior
|
||||
{
|
||||
private readonly DbService _db;
|
||||
private readonly IPubSub _pubSub;
|
||||
@@ -39,7 +38,7 @@ namespace NadekoBot.Modules.Permissions.Services
|
||||
return default;
|
||||
}
|
||||
|
||||
public Task<bool> RunBehavior(DiscordSocketClient _, IGuild guild, IUserMessage usrMsg)
|
||||
public Task<bool> RunBehavior(IGuild guild, IUserMessage usrMsg)
|
||||
{
|
||||
foreach (var bl in _blacklist)
|
||||
{
|
||||
|
@@ -63,7 +63,7 @@ namespace NadekoBot.Modules.Permissions.Services
|
||||
return Task.FromResult(false);
|
||||
}
|
||||
|
||||
public Task<bool> TryBlockLate(DiscordSocketClient client, ICommandContext ctx, string moduleName, CommandInfo command)
|
||||
public Task<bool> TryBlockLate(ICommandContext ctx, string moduleName, CommandInfo command)
|
||||
{
|
||||
var guild = ctx.Guild;
|
||||
var user = ctx.User;
|
||||
|
@@ -17,7 +17,7 @@ using Serilog;
|
||||
|
||||
namespace NadekoBot.Modules.Permissions.Services
|
||||
{
|
||||
public class FilterService : IEarlyBehavior, INService
|
||||
public class FilterService : IEarlyBehavior
|
||||
{
|
||||
private readonly DbService _db;
|
||||
|
||||
@@ -117,13 +117,13 @@ namespace NadekoBot.Modules.Permissions.Services
|
||||
if (guild is null || usrMsg is null)
|
||||
return Task.CompletedTask;
|
||||
|
||||
return RunBehavior(null, guild, usrMsg);
|
||||
return RunBehavior(guild, usrMsg);
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<bool> RunBehavior(DiscordSocketClient _, IGuild guild, IUserMessage msg)
|
||||
public async Task<bool> RunBehavior(IGuild guild, IUserMessage msg)
|
||||
{
|
||||
if (!(msg.Author is IGuildUser gu) || gu.GuildPermissions.Administrator)
|
||||
return false;
|
||||
|
@@ -21,7 +21,7 @@ namespace NadekoBot.Modules.Permissions.Services
|
||||
}
|
||||
|
||||
|
||||
public Task<bool> TryBlockLate(DiscordSocketClient client, ICommandContext ctx, string moduleName, CommandInfo command)
|
||||
public Task<bool> TryBlockLate(ICommandContext ctx, string moduleName, CommandInfo command)
|
||||
{
|
||||
var settings = _bss.Data;
|
||||
var commandName = command.Name.ToLowerInvariant();
|
||||
|
@@ -98,8 +98,7 @@ namespace NadekoBot.Modules.Permissions.Services
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<bool> TryBlockLate(DiscordSocketClient client, ICommandContext ctx, string moduleName,
|
||||
CommandInfo command)
|
||||
public async Task<bool> TryBlockLate(ICommandContext ctx, string moduleName, CommandInfo command)
|
||||
{
|
||||
var guild = ctx.Guild;
|
||||
var msg = ctx.Message;
|
||||
|
Reference in New Issue
Block a user