Streamer chat bot rate limiting and Twitch game integration?

Hey gang! We could use advice or workarounds – we’re finding that Pretty Big Streamers™ (> 1,000 viewers) often get chat banned after playing for a while with our Twitch integration.

The current auth / Twitch mode game flow is:

  1. Twitch streamer requests an OAuth key from TMI
  2. They enter that key in the game
  3. The game client chats as the streamer on IRC, and their account acts as the feedback interface to actions. E.g.:
    User: !spawn jetpack2
    Streamer: Jetpack 2 spawned!
    User: !coins
    Streamer: KappaWealth You have 2000 Danger Coins KappaWealth

Expected: The streamer’s account can spam their own channel with bot feedback all they want. Chatters troll the streamer with enemies, emoticons, and extra lives. A rainbow appears and a dove sings a beautiful song.

Actual: The streamer’s account stops responding after a while, as they have been issued a temporary chat ban for their high volume of messages to their own channel.

Here are the workarounds we’re brainstorming, but none of them feel great.

  1. Encourage or provide a button for big streamers to use /slowmode <seconds> when connecting to the game.
  2. Throttle streamer output. We’d need a trustworthy upper-limit on allowed messages / minute.
  3. Allow streamers to connect multiple accounts. (bleh, wouldn’t help much)
  4. Connect a dedicated bot account (which we operate on servers somewhere) to their channel for the interaction.
  5. Have the streamer’s bot use Whispers. (would this annoyingly flood their account’s messages, though?)

Ideally some options would be:

  1. Streamers can message the crap out of their own channel in response to high volume of player interaction.
  2. Some sort of way of allowing this (sending messages from the streamer through a different API, ideally still only requiring their existing TMI tokens?)

Thanks for any advice!

Is the “bot” running on your servers or the streamer’s local PC since the resulting lockout is IP based? Either way you will want to limit the message rate under 100 messages and commands within any 30 second window.

Whispers would not be possible due to the strict rate limits and whitelisting would be impossible since the app doesn’t run on a single account.

1 Like

It should also be noted that the message limit is per connection, not per IP, so one workaround could be to open multiple concurrent connections and split the messages to be sent between them.

Even if you do this though you should still implement a message queuing system that either drops messages entirely when one connection is nearing the limit (as the ban is account based, so if one connection breaks it they all get banned) or delays messages being sent until there has been sufficient time since previous messages. The number of connections should also be limited so that large channels (or channels with malicious users trying to force the bot to spam) don’t get too excessive.

I don’t know what sort of game requires that many messages that you’re frequently running into this being an issue, but other consideration might be to rethink what messages you send to the channel, for example are all the messages essential or could some be skipped if it’s a duplicate of another recent message? could the streamer potentially have options to enable/disable certain message types?

@bribrobot If the accounts are sending more than 100 messages per 30 seconds, you need to limit the messages.

If they are normal messages (text) and not commands to the server (like timeouts, bans, etc…) you definitely have a problem on your end because no bot should send that many messages every 30 seconds per channel. That would generate too much “spam” and the chat would get clogged really easily.

In this case I wouldn’t recommend splitting TCP connections as a workaround since it would probably violate the developers agreement by bypassing twitch limits in an unwanted way.

In your specific case, whispers are a big no-no.

So, with all this, I see 2 options for you:

  • Move all the messages to the game itself:
    For example, show some type of “actions” box in the corner of the game screen with some type of action log. The log would contain what the most recent viewers “activate” when interacting with the game.

  • Limit the amount of messages the streamer sends:
    You could select the type of messages that you find necessary for feedback and maybe use a cooldown for repetitive messages.
    Either wait for like 5 seconds when a user triggers something and group the names of each viewer that also triggers the same thing in those 5 seconds into one message, or simply use a cooldown for repetitive actions but then some viewers wouldn’t get any feedback about the success or failure of their action.

Let us know if you still need help and if you find a solution please post it here so everyone can see :slight_smile:

Another solution could be a webpage that scrolls/shows the responses, that can be put into the streamers live stream, as an overlay. Like donation and sub alerts.

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