How do you handle the message limitation?

I started working on a bot and after some reading I saw that there was a 20 message limit in a 30 second time period before getting locked out for 8 hours. That didn’t seem like a lot of messages, so I made a buffer in my code. I’ll post the code below, but basically instead of writing to my channel directly, I call writeToBuffer MESSAGE. Then a timer that runs every second prints out one line of my buffer. Whenever I reach my buffer max size, it wraps around to the beginning of the list. I was pretty happy that I got it working, but then I saw that for mods, it is a 100 message limit in 30 seconds and you only get disconnected rather than banned. That seems like a pretty hard limit to hit, so maybe this buffer thing isn’t needed. How do people with thousands of viewers handle the message limit?

My Code

alias -l writeToBuffer {

  if ($1 != $null) {
    set %buffer. $+ %bufferNext $1-
    inc %bufferNext

    if (%bufferNext == %bufferMax) {
      set %bufferNext 0
    }
  }
}

alias -l writeFromBuffer {
  if ($($+(%,buffer.,%bufferCurrent),2) != $null) {
    msg %channel $($+(%,buffer.,%bufferCurrent),2)
    set %buffer. $+ %bufferCurrent $null
    inc %bufferCurrent

    if (%bufferCurrent == %bufferMax) {
      set %bufferCurrent 0
    }
  }
}

timerBufferWriter 0 1 writeFromBuffer

Edit: using the preformatted blocks now

The only way “around” limits is to scale up the number of connections used to access chat. Unless all the channels your bot is in have actually added the bot as a moderator to the channel, then the 100 message limit is useless. For that reason, you should be careful when creating logic conforming to 100 messages and actually just continue to limit messages at 20.

As an aside, please either use code blocks or a pastebin to share your code in the future.

Ah ok. I just read up on how some of the bots work by adding the bot to your channel. I assumed to add a bot you had to download the code and run it from your PC.

I’m looking at just running my own bot from my own PC and I will be the only one using it. I guess I’ll keep the buffer code in for now unless it becomes buggy or laggy.

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