Question on ban/timeout rate limits

Hi guys,

I have a rate limiting question. If you send a batch of bans or timeouts, (ie /ban or /timeout), does this count towards the message rate limit or is it treated separately since it’s a command?

If they are part of the normal rate limit, I assume if you send them round-robin over a number of connections within the rate limit of each connection, it will work?

Example: you want to ban 300 users from 1 channel. The rate limit is 100 messages per 30 seconds. If you open 3 connections, can you send 100 /ban commands on each of them in the same 30 second period to ban 300 users?


(Edit: in case anyone is wondering, this is for a shared ban list across several channels)

All PRIVMSGs, chat commands or not, count towards the 20/100 per 30 seconds limit. Sending more than a 100 messages in 30 seconds to a single channel should very rarely, if ever, be required.

How do we handle large channels? It’s only happened once, but let’s say 300 bots are all spamming the same message and they get banned by my bot.

My bot then get’s global’d. Is there some sort of whitelist that can be created for known bots, similar to the whisper anti-spam that xangold was mentioning in another thread.

If your bot got globalled then you haven’t got your bot global protection right.

The “correct” thing to do here is to chunk the channel in sub mode and spread the clean up between the mods.

Of course such a spam bot should be reported. But when you get “hit” like that there is little you can do. Even the big bots like nightbot, xanbot and moobot are not whitelisted.

The whisper thing is just because Twitch are working on a new spam filter to find these bots and it’s catching tooooo many false positives, because, well, the bots look like bots

I’ll look into limiting the number of timeouts in a given time period. But that is exactly what we do, go sub mode as soon as possible. Like i said it only happened once, but will modify my code accordingly.

The command limit is for ALL MESSAGES.


  • .ban
  • .timeout
  • Bot Speaking/responding to a chat command

Are all including in the limit.
Or put another way.

Any PRIVMSG sent to chat needs to be accounted for in your limiter, not just timeouts.

Yes, I know. I was mentioning .timeouts because that’s what triggered the global last time.


Thanks for the feedback guys, much appreciated.

As an aside, I think that if you have a known ban list which exceeds 300 users and you want to apply it to a new channel, sending over 100 ban messages in 30 seconds is a perfectly reasonable requirement.

Hmmm that use case would kind of be a bit frowned upon.

Banning people in a new channel for breaking the rules in another channel is a grey area and probably not advisable.

Given that such a spam bot being discussed here, is likely to get a global ban from Twitch and thus not even worth banning in another channel as Twitch bans the accounts.

Basically banning uses in another channel for breaking rules elsewhere is a bit of a no no, and thus doesn’t apply.

It is NEVER a reasonable requirement to be a spamming a channel with messages or commands, globals are more there to protect against bot’s misbehaving

There are two methods I know of, if you are interested. Limiting the delay between messages to roughly 30ms or more, or keeping timestamps:

The reaction to reaching this limit might either be queuing up the messages to send later, or creating/using more connections to circumvent. You could even have, say three sockets active at all times and distribute outgoing messages round-robin - and now your limit is guaranteed at 300/30 without much fail-checking.

1 Like

BarryCarlyon: users will have full control over whether they choose to opt in to such a list or not, and will have a number of filtering and exclusion options available. I have contacted the Twitch chat devs about this.

Livewhiletrue: I haven’t actually written any ban code yet but in terms of connections that is what I currently do - both keep multiple connections open, and rate limit each one to slightly under 100/30. Thanks for the tips tho :smile:

Best of luck with it.

I’ve seen a few projects along those lines before, they have all failed in one way or another.

Thanks. I fully agree it is a very complicated issue and one that must be treated with utmost care.

Edit: and of course, the bot will never send many commands to any channel unless the channel owner wishes for it.

BTW BarryCarlyon, just out of curiosity, do you know why the other projects failed and what their goals were?

I wasn’t involved so can’t say for sure. I’ve just seen a few kicking about.

There is ONE that I think exists, which I can’t talk about as it officially doesn’t exists.

Largely they fall over due to the management needs and continual updates required. And I know for me, gotta put the paid stuff before the free stuff, one these things done well, multichannel, can get expensive pretty quick, both in terms of time, money, and investment of expertise

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.