Closed bradtaniguchi closed 2 years ago
Those docs appear to require the use of discord.js-commando
which hasn't been updated in two years.
It looks like it still might work, but would require a complete refactor of our code.
could always re-engineer some other solution, either manually or some other way :)
How about this?
I could create a variable that counts how many times the bot has detected a command, have the bot reject the call if that variable hits 10, and set an interval to clear that count every minute. That would effectively mean the bot would only respond to 10 command calls a minute (across all users and commands), averaging to one call every six seconds.
Taking the old unmaintained bot extesnions as an example, this code does something similar to what we should have: https://github.com/discordjs/Commando/blob/f80823ed6fc3887a8cfb74a9345c59c6c2658545/src/extensions/message.js#L179
where the bot will limit the same user + command from being spammed. Other user's aren't affected by any limiting.
Discord automatically rate-limits slash commands so we no longer need this.
Is your feature request related to a problem? Please describe. Currently users can call commands as often as quickly as possible. This allows for easier spam situations.
Describe the solution you'd like We should throttle command calling by user to prevent spam.
Additional context Here are the docs on the subject: https://discordjs.guide/commando/throttling.html#throttling