Rate limit Twitch stream announces
tsa96 opened this issue · 0 comments
tsa96 commented
We quite often see Twitch streams on bad internet spamming the #live-streams channel every time their stream restarts. Also, it's obviously pretty abuse-able, so worth limiting before 1.0.0 drops.
Here's a sketch of the system we've been discussing:
- When a stream message is deleted, store the streamer ID, and schedule a method call for 1 hour in the future (time should be configurable)
- If it drops and comes back up a first time, announce again but don't ping users with the "@LiVe Streams" role.
- If it drops and comes back up a second time, don't re-announce, but track that this has happened.
- In the delayed call scheduled in (1), check if the stream is in the announce-blocked state tracked in (3), and re-announce it.
- Follow the same logic each hour, if it's been reannounced, allow it to drop and be re-announced only once per hour.
- Stream pings should be limited to once per 6 hours (again, this can be configurable), so any re-announces 6 hours after the first announce don't ping.
This should be a fun little programming task that doesn't require a great deal of knowledge of DSharpPlus, mostly just C# task scheduling and writing sensible data structures for handling the states. So a very good first issue.