TicketsBot/worker

add ability to limit amount of tickets a user can open in a single time period

Opened this issue · 0 comments

Problem

https://docs.ticketsbot.net/setup/dashboard#ticket-limit showcases how to limit a user to a specific amount of tickers at one time. However, this does not prevent the user from ticket-spamming (by opening and closing tickets) unless the Allow Users To Close Tickets option is disabled. This means that a server that deals with ticket-spammers must sacrifice ticket efficiency for security or resource efficiency.

We do not impose any limits on the amount of tickets that a server can have open at once. However, please note that Discord only permits a total of 500 channels to exist in a server at once, and 50 channels to exist at once in a category. This means that you can move tickets to a new category if one gets filled, however you are limited to 500 channels overall by Discord.

Note: There's a limit of 1000 active threads across the whole server.

Solution

Allow servers to set ticket thresholds per insert specified time period. This can be technically described as a second rate limit that occurs at a larger scale. This means that spammers will be prevented by Discord's Rate Limit, The Bot Limit, and the Threshold. As an example, allowing one user to open 25 tickets per DAY.

Implementation

https://pkg.go.dev/golang.org/x/time/rate