All pastes #822660 Raw Edit

Someone

public text v1 · immutable
·published 2007-12-18 21:34 UTC
rendered paste body
; ANY PROBLEMS CONTACT `UNKNOWN ON #PUGZILLA
on *:START:{ server irc.gamesurge.net }
on *:CONNECT:{ as auth spxhost2 #sparx }
on *:TEXT:*:#:{
  if ($chan == $bot.chan) {
    inc -u [ $+ [ $flood.time ] ] %spam. [ $+ [ $nick ] ]
    if (%spam. [ $+ [ $nick ] ] > $flood.limit) {
      inc %times. [ $+ [ $nick ] ]
      if (%times. [ $+ [ $nick ] ] == 1) {
        notice $nick $flood.nmsg
      }
      elseif (%times. [ $+ [ $nick ] ] == 2) {
        kick # $nick $flood.kmsg
      }
      elseif (%times. [ $+ [ $nick ] ] == 3) {
        unset $v1
        cs $chan tb $wildsite $flood.btime $flood.bmsg
      }
    }
    if (($left($1,1) == $trigger) && ($ulevel == 10)) {
      if ($1 == $+($trigger,nick)) {
        if (!$2) { notice $nick Invalid Syntax: nick <nickname> }
        else { nick $2 | notice $nick Done. }
      }
      if ($1 == $+($trigger,bind)) {
        if (!$2 || !$3 || $2 == mode) {
          notice $nick Invalid Syntax: bind <command> <text>
          notice $nick You can also include $ $+ open $ $+ sep $ $+ clos
          notice $nick These are openers, seperators, and closers that can be set with set.
          notice $nick Note: When binding DO NOT include the trigger in the command name.
        }
        else {
          writeini vars.ini binds $2 $3-
          notice $nick < $+ $2 $+ > $3-
        }
      }
      if ($1 == $+($trigger,unbind)) {
        if (!$2) {
          notice $nick Invalid Syntax: unbind <command>
          notice $nick This will unbind a command.
        }
        else {
          remini vars.ini binds $2
          notice $nick Removed command $2 $+ .
        }        
      }
      if ($1 == $+($trigger,adduser)) {
        if ($left($2,4) != *!*@) { notice $nick Invalid Syntax: Use $+($trigger,adduser) <Address of user in the *!*@host form> }
        else { auser 10 $2 | notice $nick Added $2 to the user list. }
      }
      if ($1 == $+($trigger,deluser)) {
        if ($left($2,4) != *!*@) { notice $nick Invalid Syntax: Use $+($trigger,deluser) <Address of user in the *!*@host form> }
        else { ruser $2 | notice $nick Removed $2 from the user list. }
      }
      if ($1 == $+($trigger,help)) { notice $nick Commands: Bind, Unbind, Adduser, Deluser }
      if ($1 == $+($trigger,set)) {
        if (!$2) { notice $nick Please use set <flood,bad-word,join-part,trigger,bind,ads,chan> }
        if ($2 == chan) {
          if (!$3) { notice $nick Invalid Syntax: set chan <#chan>. Set's the channel the bot should respond to. }
          else { writeini vars.ini settings chan $3 | notice $nick Bot channel is now $bot.chan }
        }
        if ($2 == flood) {
          if (!$3) { notice $nick Please use set flood <time,limit,notice-message,kick-message,ban-message,ban-time> }
          if ($3 == time) {
            if (!$4) { notice $nick Flood time: The amount of time the flood limit of messages can be sent in. }
            if ($4) {
              if ($4 !isnum) { notice $nick Please provided a number for the flood time. }
              else { writeini vars.ini flood time $4 | notice $nick Flood time is now set to $flood.time }
            }
          }
          if ($3 == limit) {
            if (!$4) { notice $nick Flood limit: The amount of messages that can be sent in the flood time. }
            if ($4) {
              if ($4 !isnum) { notice $nick Please provided a number for the flood limit. }
              else { writeini vars.ini flood limit $4 | notice $nick Flood limit is now set to $flood.limit }
            }
          }
          if ($3 == ban-time) {
            if (!$4) { notice $nick Ban time: The time the user will be banned from the channel for a flood. Provide it as you would for ChanServ (1d, 2w, etc.) }
            if ($4) { writeini vars.ini flood bantime $4 | notice $nick Ban Time is now set to $flood.btime }
          }
          if ($3 == notice-message) {
            if (!$4) { notice $nick Notice Message: The message sent to the offending user when he has reached the flood limit. }
            if ($4) { writeini vars.ini flood noticemsg $4 | notice $nick Notice message is now set to $flood.nmsg }
          }
          if ($3 == kick-message) {
            if (!$4) { notice $nick Kick Message: The message sent to the offending user when he has reached the flood limit. }
            if ($4) { writeini vars.ini flood kickmsg $4 | notice $nick Kick message is now set to $flood.kmsg }
          }
          if ($3 == ban-message) {
            if (!$4) { notice $nick Ban Message: The message sent to the offending user when he has reached the flood limit. }
            if ($4) { writeini vars.ini flood banmsg $4 | notice $nick Ban message is now set to $flood.bmsg }
          }
        }
        if ($2 == bad-word) {
          if (!$3) { notice $nick Please use set bad-word <list,action,msg,remword,level> }
          if ($3 == list) {
            if (!$4) { notice $nick Type $1- <word [word word]> to add a word to the list. | notice $nick Current list: $iif($word.list,$v1,None.) }
            else { 
              var %x = 1, %t = $4-
              while ($strip($gettok(%t,%x,32))) {
                if ($istok($word.list,$v1,32)) { goto already | break }
                else { inc %x }
              }
              writeini vars.ini wordfilter list $word.list $4- | notice $nick Added $4- to the bad word list.
              goto finish
              :already
              notice $nick One or more of the words you provided are already on the list. Please try again without these words.
            }
          }
          if ($3 == remword) {
            if (!$4) { notice $nick Type $1- <word [word word]> to remove a word from the list. | notice $nick Current list: $iif($word.list,$v1,None.) }
            elseif (!$remtok($word.list,$4,1,32)) {
              remini vars.ini wordfilter list
            }
            else {
              writeini vars.ini wordfilter list $remtok($word.list,$4,1,32)
            }
            notice $nick Removed $4 from the bad word list.
          }
          if ($3 == action) {
            if (!$4) { notice $nick Bad-Word Action: This can be any command used by ChanServ (kick, ban, tb, etc.) used to punish the offending user. }
            else { writeini vars.ini wordfilter action $4- | notice $nick Bad-Word Action is now set to $4- }
          }
          if ($3 == msg) {
            if (!$4) { notice $nick Bad-Word Message: This is the message sent to the offending user. }
            else { writeini vars.ini wordfilter msg $4- | notice $nick Bad-Word Message is now set to $4- }
          }
          if ($3 == level) {
            if ($4 != none && $4 != voice && $4 != op) { notice $nick Bad-Word Level: This is the max level of user protected from the bad-word action (set to none, voice, or op). }
            else { writeini vars.ini wordfilter level $4 | notice $nick Bad-Word Level is now set to $4 }
          }
        }
        if ($2 == trigger) {
          if ($len($3) != 1) { notice $nick Trigger: Change the trigger of your binds }
          else { writeini vars.ini settings trigger $3 | notice $nick Trigger is now set to $trigger } 
        }
        if ($2 == ads) {
          if (!$3) { notice $nick Please use set ads <action,msg,www,level> }
          if ($3 == action) {
            if (!$4) { notice $nick Ads Action: This can be any command used by ChanServ (kick, ban, tb, etc.) used to punish the offending user. }
            else { writeini vars.ini ads action $4- | notice $nick Ads Action is now set to $4- }
          }
          if ($3 == msg) {
            if (!$4) { notice $nick Ads Message: This is the message sent to the offending user. }
            else { writeini vars.ini ads msg $4- | notice $nick Ads Message is now set to $4- }
          }
          if ($3 == www) {
            if (($4 != 0) && ($4 != 1)) { notice $nick Ads WWW (Websites): Kicks the user for sending a website. (Set to 0 or 1) }
            else { writeini vars.ini ads www $4 | notice $nick Ads WWW (Websites) is now $iif($ads.www,on.,off.) }
          }
          if ($3 == level) {
            if ($4 != none && $4 != voice && $4 != op) { notice $nick Ads Level: This is the max level of user protected from the ads action (set to none, voice, or op). }
            else { writeini vars.ini ads level $4 | notice $nick Ads Level is now set to $4 }
          }
        }
        if ($2 == join-part) {
          if (!$3) { notice $nick Please use set jp <action,msg,level> }
          if ($3 == action) {
            if (!$4) { notice $nick Join-Part Action: This can be any command used by ChanServ (kick, ban, tb, etc.) used to punish the offending user. }
            else { writeini vars.ini jp action $4- | notice $nick Join-Part Action is now set to $4- }
          }
          if ($3 == msg) {
            if (!$4) { notice $nick Join-Part Message: This is the message sent to the offending user. }
            else { writeini vars.ini jp msg $4- | notice $nick Join-Part Message is now set to $4- }
          }
          if ($3 == level) {
            if ($4 != none && $4 != voice && $4 != op) { notice $nick Join-Part Level: This is the max level of user protected from the jp action (set to none, voice, or op). }
            else { writeini vars.ini jp level $4 | notice $nick Join-Part Level is now set to $4 }
          }
          if ($3 == time) {
            if ($4 !isnum) { notice $nick Join-Part Time: This is the time the user must idle the channel to avoid the punishment. (In seconds) }
            else { writeini vars.ini jp time $4 | notice $nick Join-Part Time is now set to $4 }
          }
        }
        if ($2 == bind) {
          if (!$3) { notice $nick Please use bind <opener,seperator,closer,mode> }
          if ($3 == opener) {
            if (!$4) { notice $nick Invalid Syntax: Use opener <text> }
            if ($4) { alias open return $4- | notice $nick Opener: $open }
          }
          if ($3 == closer) {
            if (!$4) { notice $nick Invalid Syntax: Use closer <text> }
            if ($4) { alias clos return $4- | notice $nick Closer: $clos }
          }
          if ($3 == seperator) {
            if (!$4) { notice $nick Invalid Syntax: Use seperator <text> }
            if ($4) { alias sep return $4- | notice $nick Seperator: $sep }
          }
          if ($3 == mode) {
            if ($4 != msg && $4 != notice) { notice $nick Invalid Syntax: Use mode <msg,notice> }
            if ($4) { writeini vars.ini binds mode $4 | notice $nick Bind Mode: $bind.mode }
          }
        }
      }
    }
    if (($left($1,1) == $trigger) && ($bind.get($right($1,-1)))) {
      if ($bind.mode == notice) {
        notice $nick $bind.get($right($1,-1))
      }
      if ($bind.mode == msg) {
        msg $chan $bind.get($right($1,-1))
      }
      goto finish
    }
    var %x = 1, %t = $1-
    while ($strip($gettok(%t,%x,32))) {
      if ($istok($word.list,$v1,32)) { goto bad-word | break }
      else { inc %x }
    }
    if ((*www.*.* iswm $strip($1-)) && ($ads.www)) goto adfound
    var %w = 1, %q = $1-
    while ($gettok(%q,%w,32)) {
      if ($left($strip($v1),1) == $chr(35)) { goto adfound | break }
      else { inc %w }
    }
    goto finish
    :adfound
    if ($ads.level == voice) {
      if ($nick isreg $chan) {
        $ads.action $nick $ads.msg
      }
    }
    elseif ($ads.level == op) {
      if (($nick isvoice $chan) || ($nick isreg $chan)) {
        if ($istok($ads.action,tb,32)) {
          cs $chan $gettok($ads.action,1,32) $nick $gettok($ads.action,2,32) $ads.msg
        }
        cs $chan $ads.action $nick $ads.msg
      }
    }
    elseif ($ads.level == none) {
      if ($istok($ads.action,tb,32)) {
        cs $chan $gettok($ads.action,1,32) $nick $gettok($ads.action,2,32) $ads.msg
      }
      cs $chan $ads.action $nick $ads.msg
    }
    goto finish
    :bad-word
    if ($word.level == voice) {
      if ($nick isreg $chan) {
        $word.action $nick $word.msg
      }
    }
    elseif ($word.level == op) {
      if (($nick isvoice $chan) || ($nick isreg $chan)) {
        if ($istok($word.action,tb,32)) {
          cs $chan $gettok($word.action,1,32) $nick $gettok($word.action,2,32) $word.msg
        }
        cs $chan $word.action $nick $word.msg
      }
    }
    elseif ($word.level == none) {
      if ($istok($word.action,tb,32)) {
        cs $chan $gettok($word.action,1,32) $nick $gettok($word.action,2,32) $word.msg
      }
      cs $chan $word.action $nick $word.msg
    }
    :finish
  }
}

on *:JOIN:$bot.chan:{
  set %join. [ $+ [ $wildsite ] ] $time
}

on *:PART:$bot.chan:{
  if ($calc($ctime($time) - $ctime(%join. [ $+ [ $wildsite ] ])) < $jp.time) {
    $jp.action $wildsite $jp.msg
  }
}

alias bot.chan {
  return $readini(vars.ini,settings,chan)
}

alias flood.time {
  return $readini(vars.ini,flood,time)
}

alias flood.btime {
  return $readini(vars.ini,flood,bantime)
}

alias flood.limit {
  return $readini(vars.ini,flood,limit)
}

alias flood.nmsg {
  return $readini(vars.ini,flood,noticemsg)
}

alias flood.kmsg {
  return $readini(vars.ini,flood,kickmsg)
}

alias flood.bmsg {
  return $readini(vars.ini,flood,banmsg)
}

alias word.list {
  return $readini(vars.ini,wordfilter,list)
}

alias word.action {
  return $readini(vars.ini,wordfilter,action)
}

alias word.msg {
  return $readini(vars.ini,wordfilter,msg)
}

alias word.level {
  return $readini(vars.ini,wordfilter,level)
}

alias ads.action {
  return $readini(vars.ini,ads,action)
}

alias ads.msg {
  return $readini(vars.ini,ads,msg)
}

alias ads.level {
  return $readini(vars.ini,ads,level)
}

alias ads.www {
  return $readini(vars.ini,ads,www)
}

alias bind.mode {
  return $readini(vars.ini,binds,mode)
}

alias bind.get {
  return $readini(vars.ini,binds,$1)
}

alias trigger {
  return $readini(vars.ini,settings,trigger)
}

alias jp.action {
  return $readini(vars.ini,ads,action)
}

alias jp.msg {
  return $readini(vars.ini,ads,msg)
}

alias jp.level {
  return $readini(vars.ini,ads,level)
}

alias jp.time {
  return $readini(vars.ini,ads,time)
}




------------------------------------------------------
make a var file
------------------------


[flood]
time=10000000000000000000000000000
limit=10000000000000000000000000000
noticemsg=You've been warned for spamming.
bantime=10min
kickmsg=You've been kicked for spamming.
banmsg=You've been banned for $flood.btime for spamming.

[settings]
trigger=.
chan=#spx

[wordfilter]
level=op
action=k
msg=Out with your foul mouth!
list=fuck

[ads]
level=op
action=k
msg=Please stop advertising.
www=1

[jp]
action=tb 20min
msg=Stay here or stay out!
time=300
[binds]
noob=Noooooooobie Crisp!
mode=msg