Search code examples
mirc

mIRC 'null' delimiter for $gettok


Sorry if my title wasn't clear enough. I'm back for some more guidance!

I'm trying to set up a unique language kicking bot. The chats I moderate have influxes of Russian language chat spammers. So I was trying to set up a bot that kicks someone when they type in Russian. So I set this up:

alias -l russian.words { RETURN Л.Д.э.И }

ON @*:TEXT:*:#: {
  IF ($nick isop #) return
  VAR %x = $strip($1-) , %i = $numtok($russian.words,46)
  WHILE (%i) {
    IF ($istok(%x,$gettok($russian.words,%i,46),32)) {
      raw -q mode # +b $wildsite
      msg # $nick $+ , English in chat, please! Только на английском языке в чате!
      msg # /timeout $nick 1
      RETURN
    }
    DEC %i
  }
}

The problem is that the bot checks for the russian letters only if they are 'on their own'. If the Russian letters are part of a larger sentence/word, the bot doesn't work.

I believe it's because of the delimiter in the $gettok, which is set at 32 (a space). However, when I change the delimiter to 0 (null), the bot doesn't work at all.

So right now, the only thing the bot kicks are people who use ONLY those specific letters. I want the bot to kick to anyone who uses those letters on their own or when in a sentence/word.

BTW, I've chosen these letters because they are considered the most common Russian letters that do not share the same letters as English.

Any help is appreciated.


Solution

  • try this
    paste into a new remote file

    on $@*:text:/(Л|Д|э|И)/iS:#:{
    if ($nick !isop $chan) {
    ban -k $nick 2 English in chat, please! Только на английском языке в чате!
    }
    }