The way it's creating the %text variable makes it be a match if their text is the same thing regardless of upper/lower case, whether there are color codes, or whether they have different amount of spaces padding.

This is checking for an exact match, so it doesn't catch when someone changes punctuation or adds a word, etc.

the "#" can change to be either a #channelname or #chan1,#chan2

The TEXT and ACTION events are so it can trap them doing it in channel messages and in /me sentence.

The %allowed can change to 1 or 3 depending how many times you let them say it. The -u30 makes the variable exist for 30 seconds until it goes away, and you can change it to whatever seconds you wish. Each time they say something, the counter for that text increments +1 with an additional life of 30 seconds.

The %item label is created by combining their nick, the channel name, and the hash of what they say. If there are any false-positive matches, then congratulations, you've discovered a hard-to-find hash collision!

If you want to ban the same thing said by multiple nicks, then simply remove $nick from the list of things being combined to create the item name.


The { } after the IF statement is the section where you put whatever you want to happen when someone repeats. You can add code for checking whether the offender is an OP, etc.

This snippet doesn't monitor the change-nick event, so they're not blocked from saying it after they change nick.

Code:
on *:TEXT:*:#:{   noop $dupe_catcher($1-) }
on *:ACTION:*:#:{ noop $dupe_catcher($1-) }

alias dupe_catcher {
  var %text $lower($gettok($strip($1-),1-,32))
  var %a $sha1(%text) , %item $+($nick,$chan,.,%a) , %allowed 2
  hinc -mu30 flooder %item
  var %count $hget(flooder,%item)
  if (%count > %allowed) {
    echo -a flood: $nick has recently repeated the same thing in $chan %count times - variable is deleted in $hget(flooder,%item) secs: %text
  }
}