Trying to understand chat's rate limit

From the docs:

If you send more than 20 commands or messages to the server within 30 seconds, you will be locked out for 30 minutes.


  • A bot is connected to 200 channels.
  • 1 person from each channel types !uptime but they don’t do it at the same time. Let’s say all those 200 !uptime happen in a 20 second window.
  • The bot proceeds to output the streamer’s uptime in their respective chats and of course, happens in a 20 second window.
  • The bot is not modded in any of those channels.

Does the bot get locked out for 30 minutes?

For reference, the bot is connecting to those channels using tmi.js:

var tmi = require('tmi.js');

let client = new tmi.client({
    identity: {
        username: "username",
        password: "oauth:password"
    channels: ['channel1', 'channel2', ..., 'channel200']

client.say('oneOfTheChannels', 'their uptime');

Yes, sending 200 messages in 20 seconds will get you locked out for 30 minutes. The default rate limit is 20 messages in any 30-second period across all channels.

Ok, so how do big bots deal with this? Bots like Nightbot are being used by hundreds of channels and I don’t see them being locked out constantly.

Usually if you have a bot in a channel, it’s modded which has another rate limit.

If you send commands/messages only to channels in which you have Moderator or Operator status, the limit is 100 messages per 30 seconds.

If your bot is wanted in the channel, you can make the commands only work if it’s modded by checking the status on itself.

There is also Known status and Verified status which is noted on that same doc you listed. I believe that known is a whitelisted bot, and verified is for very very few bots that are very popular and are was granted a special trusted status. Being whitelisted and having mod in the channel greatly increases the number of messages that can be sent.

Also, you can add a delay or queue to messages being sent as a safeguard to never hit the limit.

Yes, I know about the mod limit, but if the bot is modded in every channel, it’s still 200 messages in 30 seconds. It still goes over the limit.

I’m aware of known and verified. Mine happens to have is_verified_bot set to true and is_known_bot set to false. But I have no idea about the limits in that case. How am I supposed to set a throttle mechanism when I don’t even know the extended rate limit.

And yeah, I’m sure using a queue sounds useful, but again… I’m pretty sure these big bots are in more than 1000 channels. Let’s go back to the time before known and verified. They still needed something to go around the limit, right? Cause I’m pretty sure if you’re connected to 1000 channels, it’s easy to over 100 messages in 30 seconds. A queue would make these big bots respond super slowly, which is not the case.

PS: I can’t even trust the verified thing. My bot doesn’t have the badge but the API says otherwise. And how is a bot verified but not known?

Verified bots have nothing to do with the verified badge.

They used to have auto rate limit set by IP, in which case I would think bots like NightBot ran in a cloud enviroment with multiple sessions over a different IP for each session. Each session would probably be in 10 or so channels, in addition to rate limiting each session. Some of these bots are ran by Twitch staff which probably also had some sort of special levels set but it’s probably not something they would talk about because they don’t want to hand it out.

Now rate limits are now per account and not connection, probably since they added the the known/verified status.

The best bet is to set your local rate limiting to be within the moderator rate limit.

From the docs:

Both known and verified bots: […] Have a “known bot” badge.

I wasn’t referring to the verified badge from partnered channels.

Now rate limits are now per account and not connection, probably since they added the the known/verified status.

So if I did the same example but I connect to each channel with 1 IP (so 200 IPs lol), it wouldn’t matter, correct? I’d still get locked out.

The best bet is to set your local rate limiting to be within the moderator rate limit.

How does that help though? That makes a bot unable to send more than 100 messages across all channels in a 30s window. Again, bots connected to hundreds of channels… it seems to me like that limit is way too easy for these big bots to hit.

The IP thing you described is what I’ve heard in the past. In fact, I was able to use the bot account normally if it got locked out on my server. But I don’t know if it still works like that, cause when I test with a dummy account my IP seems to be locked out too, which makes it even harder for me to test this. I can’t tell if the strategy I implement fails because the bot is going over the limit or because the IP got locked out.

The docs may have jumped the gun there… No such badge exists yet.

1 Like

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