Skip to content

Conversation

@Felk
Copy link
Member

@Felk Felk commented Sep 20, 2021

No description provided.

@Felk Felk force-pushed the commands_cooldowns branch from 4da9ff5 to 98bf260 Compare September 20, 2021 19:58
@Felk Felk force-pushed the commands_cooldowns branch from 98bf260 to e87d729 Compare September 20, 2021 20:05
Copy link
Contributor

@Mogiiii Mogiiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants