- 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:
Kwoth
2021-06-28 23:20:02 +02:00
parent 1e90d7f7bb
commit 3c82c1f919
30 changed files with 217 additions and 360 deletions

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();

View File

@@ -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;