Early behavior fixups:

- Priorities are now higher number -> higher priority
- Priorities are now actually respected
- Early behaviors now print custom messages when they perform an action (Filter trigger, blacklist, poll vote, etc)
- small cleanup
This commit is contained in:
Kwoth
2021-07-03 01:46:32 +02:00
parent e681978f83
commit aeb6f8662c
9 changed files with 77 additions and 36 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
@@ -28,11 +29,11 @@ namespace NadekoBot.Services
{
_lateExecutors = _services.GetServices<ILateExecutor>();
_lateBlockers = _services.GetServices<ILateBlocker>();
_earlyBehaviors = _services.GetServices<IEarlyBehavior>();
_earlyBehaviors = _services.GetServices<IEarlyBehavior>()
.OrderByDescending(x => x.Priority);
_transformers = _services.GetServices<IInputTransformer>();
}
// todo early behaviors should print for themselves
public async Task<bool> RunEarlyBehavioursAsync(SocketGuild guild, IUserMessage usrMsg)
{
foreach (var beh in _earlyBehaviors)