Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Feature Extension HBS: Create a anti-spam protection for the command #35

Open
illusi0nary opened this issue Oct 4, 2020 · 2 comments
Open
Labels
extension good first issue Good for newcomers hacktoberfest Issue dedicated to the Hacktoberfest help wanted Extra attention is needed

Comments

@illusi0nary
Copy link
Contributor

illusi0nary commented Oct 4, 2020

Feature Extension of the Halloween Bot Scare (HBS)
Currently you can spam the command as often as you want. In order to prevent spamming we want to have an anti-spam protection. The protection should prevent a single user from using the command too often in a configurable time span.

Details
The bot remembers who requested a scare request and has a configurable time duration how long and how often a user can get the bot into the channel.
If the user exceeds that limit the bot simpy ingores that user command.

@illusi0nary illusi0nary added good first issue Good for newcomers hacktoberfest Issue dedicated to the Hacktoberfest extension labels Oct 4, 2020
@illusi0nary
Copy link
Contributor Author

@tmetten mentioned that i did a little oopsie i wrote "song" instead of "scare" request. 😊

Thanks ! i corrected it!

@illusi0nary illusi0nary added the help wanted Extra attention is needed label Oct 6, 2020
@LucasCtrl LucasCtrl added this to the v1.2.0 milestone Oct 6, 2020
@tmttn
Copy link
Contributor

tmttn commented Oct 6, 2020

I have an idea for this:

  1. Add a timeout config value to each command you want protected.
  2. Modify message.js to perform a check based on the timeout and the user executing the command.
  3. Store the userid, command and date in a database when a command is executed. Make sure the database doesn't grow by updating existing entries based on userid and command.

This way, you can define different timeouts per command and the spam protected logic is contained to 1 location.

Later checks for roles could be added in message.js.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extension good first issue Good for newcomers hacktoberfest Issue dedicated to the Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants