mIRC Homepage
Posted By: judge2020 twitch.tv caps ban - 13/04/14 07:44 PM
I found a snippet code and decided to use it for my twitch bot. I edited it to my requests:
1. give a warning on first 70% caps message
2. time out on 2nd caps if it ghas been less than 5 minutes from last caps message
My bot says "stop typing in caps! [warning]" on first message without timing out, and on 2nd message it does time them out, BUT it says the same [warning] message. How would i get it to not say warning on 2nd time out?

Code:
on *:text:*:#:{
  if ($nick isop #) { halt }
  if ( $len($1-) >= 10 ) {
    if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 70 ) { msg $chan $nick -> stop typing in caps! [warning] }
    write capsban.txt $nick
    .timerCapsBan 1 300 CapsBan # $nick
  }
}
alias -l CapsBan {
  write $+(-ds,$nick) capsban.txt
}
Posted By: AllDayGrinding Re: twitch.tv caps ban - 13/04/14 08:29 PM
Thanks! Were did you find this snippet?
Posted By: AllDayGrinding Re: twitch.tv caps ban - 13/04/14 08:32 PM
Also where do you type to say a message like Ay You! Calm your caps [Warning] ??
Posted By: judge2020 Re: twitch.tv caps ban - 13/04/14 08:51 PM
Originally Posted By: AllDayGrinding
Thanks! Were did you find this snippet?
http://hawkee.com/snippet/4373/ searching a code with MIRC in it will most likely bring you to a snippet


Originally Posted By: AllDayGrinding
Also where do you type to say a message like Ay You! Calm your caps [Warning] ??


add a random variable:
Code:
on *:text:*:#:{
  if ($nick isop #) { halt }
  if ( $len($1-) >= 10 ) {
    if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 70 ) {
      var %capsblock = $rand(1,3)
      if (%capsblock == 1) { msg $chan $nick -> stop typing in caps! [caps] [warning] }
      if (%capsblock == 2) { msg $chan $nick -> Ey! stop yelling! [caps] [warning] }
      if (%capsblock == 3) { msg $chan $nick -> stop typing in BIG LETTERS! [caps] [warning] }
      write capsban.txt $nick
      .timerCapsBan 1 300 CapsBan # $nick
    }
  }
}


Also still need a way for it to not say warning the second time

EDIT: look at the "msg $chan" behind the variable spots
Code:
{ msg $chan $nick -> Ey! stop yelling! [caps] [warning] }
Posted By: AllDayGrinding Re: twitch.tv caps ban - 13/04/14 09:08 PM
You are a really good "Script Writer" I Really need help with my script would you be able to help me out?
Posted By: judge2020 Re: twitch.tv caps ban - 13/04/14 11:18 PM
I started scripting for twitch one month ago and just learned basics from other scripts that have been posted. If anything, I am a halfway good editor.

Anyone know how to make 2nd response not warn?
Posted By: blessing Re: twitch.tv caps ban - 14/04/14 01:50 AM

Code:
on !*:text:*:#:{
  if ($nick isop #) { return }
  if ( $len($1-) >= 10 ) {
    if ( $calc($regex($1-,/[A-Z]/g) / $regex($1-,/[A-Z]/gi) * 100) >= 70 ) { 
    
      ; check if user is not warned yet
      if !$istok(%caps.warned,$nick,32) {

        ; warning user      
        msg $chan $nick -> stop typing in caps! [warning] 
        
        ; add user to %caps.warned, so we can check it later
        set -e %caps.warned $addtok(%caps.warned,$nick,32)
        
        ; set timer to remove user from %caps.warned after 300s
        .timer 1 300 remove.warned $nick
      }
      else {
        ; so user is already warned.. 
        ; place your timeout command here
      }
    }
  }
}

alias -l remove.warned {
  set -e %caps.warned $remtok(%caps.warned,$1,1,32)
}
Posted By: judge2020 Re: twitch.tv caps ban - 14/04/14 11:58 AM
you have isop as a returning command :P but good script overall!

EDIT: sorry the original is right
Posted By: Nillen Re: twitch.tv caps ban - 14/04/14 12:00 PM
So, do you want to warn your own ops? If you do, just remove the line. But afaik you can't timeout another op in the twitch irc just like that. So what you could do is put that where your own lines go when timing out.

You also displayed this same statement in your original code as well. So I don't think it's too surprising that it was included.
Posted By: judge2020 Re: twitch.tv caps ban - 14/04/14 12:06 PM
edited it. was wrong...
Posted By: blessing Re: twitch.tv caps ban - 14/04/14 01:06 PM
Originally Posted By: judge2020
you have isop as a returning command :P but good script overall!

EDIT: sorry the original is right

Return is more likely same as halt. In most cases i prefer return instead of halting.
© mIRC Discussion Forums