commands cooldowns using load factors#280
Conversation
4da9ff5 to
98bf260
Compare
98bf260 to
e87d729
Compare
Mogiiii
left a comment
There was a problem hiding this comment.
Is there a way to specify some commands to ignore/add less load factor (E.G. run inputs that are expected to be spammed) and conversely heavy commands (E.G. that do lots of database operation) would cost more load factor, perhaps as a property of the command itsself. If this ends up adding more complexity than benefit feel free to disregard.
| ArgsParser argsParser) | ||
| ArgsParser argsParser, | ||
| IClock clock, | ||
| float maxLoadFactor = 200f, |
There was a problem hiding this comment.
These can be moved to class constants, E.G. DefaultMaxLoadFactor, ...
this should provide (marginally) easier fine-tuning when the time comes
| "command '{Command}' from user {User} ignored because load factor is {LoadFactor} " + | ||
| "for timeframe {Duration}, which is above the maximum of {MaxLoadFactor}", | ||
| commandName, message.User, loadFactor, _maxLoadFactorTimeframe, _maxLoadFactor); | ||
| return new CommandResult(); |
There was a problem hiding this comment.
Return some feedback to the user to let them know they are spamming too hard. I think the natural reaction to your command not being processed is to try again, which may lead to users just digging themselves into a deeper hole and frustrate nonmalicious users.
No description provided.