Here's something to flag someone saying something 5 times in 300 seconds. Change those variables to the values you want. (There's 2 places with the 300)

I don't use twitch, so you'll need to fill in the blank for what command does the 'time out'.

This works by creating a hashtable item each time someone says something, that has a lifetime of the value you set as %timeframe. After doing that, it counts how many not-expired items still alive.

This assumes you don't have a channel name having a "!" in it.

Code:
on *:TEXT:*:#*:{ $flood_counter }
on *:ACTION:*:#*:{ $flood_counter }
on *:NICK:{
  var %table flood , %timeframe 300 , %wilditem $+(*!,$fulladdress)
  while ($hfind(%table,%wilditem,1,w)) {
    hdel %table $v1
    hadd -u $+ %timeframe %table $puttok($v1,$newnick,3,33)
  }
}


alias flood_counter {
  var %timeframe 300 , %max.messages 5 , %table flood
  if (!$hget(%table)) { hmake %table 101 | hadd %table counter 1 }
  var %counter $hget(%table,counter) | hinc %table counter 1
  var %item $+(%counter,!,$chan,!,$fulladdress) , %wilditem $+(*!,$chan,!,$fulladdress)
  hadd -u $+ %timeframe %table %item | var %msg_count $hfind(%table,%wilditem,0,w)
  echo -s debug message: $nick has %msg_count messages in the last %timeframe seconds. You can delete this line
  if (%msg_count >= %max.messages) {
    echo -s action to take against $nick in $chan goes inside these brackets. This is where the time-out command goes
  }
}


Last edited by maroon; 10/12/18 03:30 AM.