small insignificant internal changes

This commit is contained in:
Toastie 2025-03-02 22:01:05 +13:00
parent 2e4e317e45
commit a54880c71f
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
2 changed files with 0 additions and 18 deletions
src/EllieBot/_common/Services

View file

@ -15,15 +15,9 @@ public class CommandHandler : IEService, ICommandHandler
public event Func<IUserMessage, CommandInfo, Task> CommandExecuted = delegate { return Task.CompletedTask; };
public event Func<CommandInfo, ITextChannel, string, Task> CommandErrored = delegate { return Task.CompletedTask; };
//userid/msg count
public ConcurrentDictionary<ulong, uint> UserMessagesSent { get; } = new();
public ConcurrentHashSet<ulong> UsersOnShortCooldown { get; } = new();
private readonly DiscordSocketClient _client;
private readonly CommandService _commandService;
private readonly BotConfigService _bcs;
private readonly IBot _bot;
private readonly IBehaviorHandler _behaviorHandler;
private readonly IServiceProvider _services;
private readonly ShardData _shardData;
@ -39,7 +33,6 @@ public class CommandHandler : IEService, ICommandHandler
DbService db,
CommandService commandService,
BotConfigService bcs,
IBot bot,
IBehaviorHandler behaviorHandler,
IServiceProvider services,
ShardData shardData)
@ -48,7 +41,6 @@ public class CommandHandler : IEService, ICommandHandler
_commandService = commandService;
_bc = bcs.Data;
_bcs = bcs;
_bot = bot;
_behaviorHandler = behaviorHandler;
_db = db;
_services = services;
@ -224,11 +216,6 @@ public class CommandHandler : IEService, ICommandHandler
{
try
{
#if !GLOBAL_NADEKO
// track how many messages each user is sending
UserMessagesSent.AddOrUpdate(usrMsg.Author.Id, 1, (_, old) => ++old);
#endif
var channel = msg.Channel;
var guild = (msg.Channel as SocketTextChannel)?.Guild;
@ -403,10 +390,6 @@ public class CommandHandler : IEService, ICommandHandler
var cmd = successfulParses[0].Key.Command;
// Bot will ignore commands which are ran more often than what specified by
// GlobalCommandsCooldown constant (miliseconds)
if (!UsersOnShortCooldown.Add(context.Message.Author.Id))
return (false, null, cmd);
//return SearchResult.FromError(CommandError.Exception, "You are on a global cooldown.");
var blocked = await _behaviorHandler.RunPreCommandAsync(context, cmd);

View file

@ -6,7 +6,6 @@ public interface ICommandHandler
string GetPrefix(ulong? id = null);
string SetDefaultPrefix(string toSet);
string SetPrefix(IGuild ctxGuild, string toSet);
ConcurrentDictionary<ulong, uint> UserMessagesSent { get; }
Task TryRunCommand(SocketGuild guild, ISocketMessageChannel channel, IUserMessage usrMsg);
}