flazzid commented on a Page, Random Insult Bot  -  Feb 01, 2014

i am making one of these right now for twitch and heres my idea of it

 on *:TEXT:!insult*:#: {

  ;check for != not equal, if anyone else but you they get flood.
  if ($nick != botownernamehere) {
    if ((%flood!insult) || ($($+(%,flood!insult.,$nick),2))) { return }
    set -u5 %flood!insult On
    set -u15 %flood!insult. $+ $nick On
  }

  if ($0 < 2) {
    msg $chan The proper way to use this bot is !insult <#> <user>
  }
  else {
    if ($2 <= $lines(insults.txt))  {

      ; this is checking to see if request is not less than 0
      if ($2 > 0 ) {

        set %user $3
        set %messsageline $2
        set %message $read(insults.txt, n, %messsageline)
        set %spot $calc($pos(%message, *) - 1 )

        if (%spot = -1) {
          ;no * found so full message is ok. and no need to check vs white list.
          set %message $read(insults.txt, n, %messsageline)
        }
        else {
          set %leftmessage $left(%message, %spot)
          set %rightmessage $right(%message, $calc($len(%message) - $calc(%spot + 1)))

          if ($3 = $ulist(%user,whitelist,1)) { 
            ;user on white list fix message to $nick not what they wanted.
            set %message %leftmessage $nick %rightmessage
          }
          else {
            ;name not on white list ok to display as requested.
            set %message %leftmessage $3 %rightmessage
          }
        }
        ; send message to chat.
        msg $chan %message

      }
      else {
        msg $chan You cannot input negative numbers
      }
    }
    ; this is if they pick a request larger than the total number of insults.
    else {
      msg $chan You exceeded the total number of insults of $lines(insults.txt) $+ .
    }
  }
}  
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.