I've been looking for a way to have my bot to count and keep a running total of how times a certain word has been typed. I want to be able to add, edit and delete the words being counted along with the word count messages. Also, I also want the word count message to be spam protected and only display the word count message in a 10 second interval, just in case if the word was typed multiple times within the 10 second period. For example, if the word "test" was typed 15 times in the 10 second interval it would only display a message such as "The word test has been typed 15 times" instead of displaying 15 word count messages.

I basically want to combine these codes I found on the forum and add the spam protection.

Here
Code:
on *:text:*count*:#: {
  inc %count $countcs($1-,count)
}


and here
Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    var %r = $read(# $+ commands.txt,ns,$2)
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) is already exist into the database! | return }
    write # $+ commands.txt $2-
    msg $chan /me + Command $2 has been added to the database!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    var %r = $read(# $+ commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -dl $+ $readn # $+ commands.txt
    msg $chan /me - Command $2- has been deleted from the database!
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    var %r = $read(# $+ commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -l $+ $readn # $+ commands.txt $2-
    msg $chan /me -> Command $2 has been updated!
  }
}
ON *:TEXT:*:#: {
  tokenize 32 $strip($1-,burci)
  if ($read(# $+ commands.txt, nts, $1)) {
    var %com = $v1
    var %com = $replace(%com,@user@,$iif($2,$2,?),@nick@,$nick,@target@,$target)
    if (-ul=mod == $gettok(%com,1,32)) && ($nick !isop $chan) { msg $chan  | return }
    msg $chan $iif(-ul=mod == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
  }
}


Maybe instead of addcom, editcom, and delcom it could be addcount, editcount, delcount to add and change the word and word count messages.

Thanks in advance.