All pastes #949939 Raw Edit

Something

public text v1 · immutable
·published 2008-03-20 05:07 UTC
rendered paste body
;;; Raw
on 1000:TEXT:$($chr(58) $+ raw *):*: {
  if ($istok($me $tag,$1,32)) { tokenize 32 $2- }
  if ($readini(Config.ini,$network,status != $nick)) { .notice $nick You must be logged in to use this command. | halt }
  $($2-,2)
}
on 1000:NOTICE:$($chr(58) $+ raw *):*: {
  if ($istok($me $tag,$1,32)) { tokenize 32 $2- }
  if ($readini(Config.ini,$network,status != $nick)) { .notice $nick You must be logged in to use this command. | halt }
  $($2-,2)
}

;;; -Tag- Commands
on $700:TEXT:$(/^-[a-zA-Z]+-([a-zA-Z]+-)? /Si):*: {
  if ($istok($1,$tag,45)) || ($1 == -all-) {
    if (all isin $1) { var %all yes }
    logstaff $iif(all isin $1,all,$tag) $2-
    tokenize 32 $2-
    if ($ulevel == 1000) && ($1 == perform) {
      $($2-,2) | halt
    }
    elseif ($istok(time uptime,$1,32)) {
      msg $iif($chan,$chan,$nick) $($+($chr(36),i,$1),2)
    }
    elseif ($istok(join part cycle hop,$1,32)) {
      if (all isin $1) && ($ulevel < 800) { .notice $nick You do not have access to this command. | halt }
      if ($1 == join) && ($rdir(cbl.ini,chans,$2)) { .notice $nick $2 is blacklisted $+($b($chr(40)),$rdir(cbl.ini,chans,$2),$b($chr(41))) | $iif($ulevel < 1000,halt) }
      $1 $iif($2,$2,$chan) $iif($1 != join,$+($upper($left($1,1)),$right($1,-1)) command used by $nick $iif($3,( $+ $3- $+ )),$3-)
    }
    elseif ($1 == comchan) {
      var %a = 1, %b
      while ($comchan($$2,%a)) {
        %b = %b $v1
        inc %a
      }
      if ($calc(%a - 1)) {
        msg $chan I am in $b($v1) channels with $2: %b
      }
    }
    elseif ($1 == ischan) {
      if ($$2 ischan) msg # I am on $2.
    }
    elseif ($1 == ccount) {
      msg $chan I am in $b($chan(0)) channels with $b($totalusers) users.
    }
    elseif ($1 == chans) {
      msg $chan $chans
    }
    if ($ulevel >= 800) {
      if ($istok(msg say,$1,32)) {
        if (#* iswm $2) { 
          if ($me !ison $2) { halt }
          if ((!* iswm $3) && ($ulevel != 1000)) { .notice $nick Nice try. | halt }
          msg $$2 $3- $iif($ulevel < 1000,$+($b($chr(40)),$nick,$b($chr(41))))
        }
        else {
          if ((!* iswm $2) && ($ulevel != 1000)) { .notice $nick Nice try. | halt }
          msg $chan $$2- $iif($ulevel < 1000,$+($b($chr(40)),$nick,$b($chr(41))))
        } 
      }
      elseif ($1 == describe) {
        describe $iif(#* iswm $2,$2,$chan) $3- $iif($ulevel < 1000,$+($b($chr(40)),$nick,$b($chr(41))))
      }
      elseif ($1 == mode) {
        $iif(#* iswm $2,$iif($me ison $2,$1-,.notice $nick I'm not on that channel.),mode $chan $2-)
      }
      elseif ($1 == update) {
        ik.update $2-
        notice $nick Running updater...
      }
      elseif ($1 == sendupdate) {
        ik.sendupdate $2-
      }    
    }
    if ($ulevel >= 900) {
      if ($1 == restart) {
        restart
      }
      elseif ($1 == global) {
        global $$2-
      }
    }
    if ($ulevel == 1000) {
      if ($istok(info,$1,32)) {
        msg $iif($chan,$chan,$nick) $($+($chr(36),i,$1),2)
      }
      elseif ($1 == rl) {
        $iif($chan,msg $chan,.notice $nick) Reloading file $qt($$2) $+ ...
        .timer 1 2 load -rs " $+ $scriptdir $+ $$2 $+ "
        .timer 1 3 $iif($chan,msg $chan,.notice $nick) $iif($script($$2),File $qt($$2) reloaded.,File $qt($$2) failed to load.)
        unload -rs $$2
      }
      elseif ($1 == al) {
        $iif($chan,msg $chan,.notice $nick) Reloading alias file...
        .timer 1 2 load -a " $+ $mircdir $+ aliases.ini"
        .timer 1 3 $iif($chan,msg $chan,.notice $nick) $iif($alias(aliases.ini),Alias file reloaded.,Alias file failed to load.)
        unload -a aliases.ini
      }
    }
  }
}

;;; Connect
on *:CONNECT: {
  ns id $decode($readini(Config.ini,$network,pass))
  mode $me +BTp
  if ($network == SwiftIRC) { cs invite #iKick.test | cs invite #iKick.staff }
  if ($readini(Config.ini,$network,autojoin) == on) {
    join $readini(Config.ini,$network,channels)
  }
  .timermarket 0 3600 market.check
  .timerucheck 0 2000 ucheck
  .timerchans 0 900 setchans
}

alias setpass {
  ini1 Config.ini $network pass $encode($$1)
}

on *:notice:*owned by someone else*:?: { 
  .msg NickServ identify $decode($readini(Config.ini,$network,pass))
}

on *:notice:*registered and protected*:?: { 
  .msg NickServ identify $decode($readini(Config.ini,$network,pass))
}

;;; Core Aliases
alias priority {
  var %x 1
  while ($token($ibots,%x,32)) {
    if ($v1 ison $1) { return $v1 }
    inc %x
  }
}

alias ibots { return iKick [RS]iKick [SS]iKick [CW]iKick [PC]iKick [BA]iKick [DM]iKick [HP]iKick [FM]iKick [XP]iKick [WC]iKick [GE]iKick [US]iKick [AU]iKick [JC]iKick [KQ]iKick [IM]iKick [ZS]iKick [QP]iKick [EU]iKick [TT]iKick [LA]iKick [NY]iKick [VS]iKick [MY]iKick [OS]iKick }
alias missingbots {
  var %x = 1
  while ($token($ibots,%x,32)) {
    if ($v1 !ison $iif($1,$1,#iKick.staff)) { set -l %mbots %mbots $v1 }
    inc %x
  }
  return $iif(%mbots,%mbots,None)
}

on *:JOIN:#iKick.staff: { if ($nick = Kol) { .auser 800 $wildsite } }

;;; Staff Aliases
alias iuptime { return [Uptime] $uptime(system,1) }
alias itime { return Today is $c1($day) $+ , the date is $c5($date(mmm/dd/yyyy)) $+ . The current time is $c2($time(hh:nn:sstt)) $+ . }
alias iinfo {
  set %w 1 | set %ww 1 | unset %size | unset %lines
  while (%w <= $script(0)) { .set %lines $calc(%lines + $lines($script(%w))) | set %size $calc(%size + $file($script(%w)).size) | inc %w 1 }
  while (%ww <= $alias(0)) { .set %lines $calc(%lines + $lines($alias(%ww))) | set %size $calc(%size + $file($alias(%ww)).size) | inc %ww 1 }
  return $c1(Scripts:) $c2($calc($script(0) + $alias(0))) $c1(Total Lines:) $c2($bytes(%lines,b)) $c1(Total File Size:) $c2($bytes(%size,b) Bytes - $bytes(%size,k).suf - $bytes(%size,m).suf) | unset %lines | unset %size | unset %w | unset %ww
}
alias chans {
  var %x = 1, %y
  while ($chan(%x)) {
    %y = %y $+($iif($left($nick($v1,$me).pnick,1) isin $prefix,$v1),$chan(%x) $chr(40),$nick($chan(%x),0),$chr(41))
    inc %x
  }
  return I am on $+($chr(2),$chan(0),$chr(2)) channels: %y
}


;;; HelpOp Commands

on $700:TEXT:$(/^((?>\Q $+ $me $+ \E) +)?[!@\.]restorenick/Si):*: {
  nick $iif($istok(i hub com,$tag,32),iKick,$+([,$upper($tag),],iKick))
}

on $700:TEXT:$(/^(((?>\Q $+ $me $+ \E)|(?>\Q $+ $tag $+ \E)) +)?[\.](a|d)?bl */Si):*: {
  if (($1 != $me) && ($priority($chan) != $me) && ($1 != .abl) && ($chan)) { halt }
  if ($istok($me $tag,$1,32)) { tokenize 32 $2- }
  if ($left($2,1) != $chr(35) && $priority($chan) == $me) || (!$chan) { .notice $nick Error: Channel names must begin with $chr(35) | halt }
  if ($1 == .bl) { $iif($chan,msg $chan,.notice $nick) Channel $b($$2) is $iif(!$rdir(cbl.ini,chans,$$2),not) blacklisted. $iif($rdir(cbl.ini,chans,$$2),Reason: $v1) | halt }
  elseif ($1 == .abl) { 
    if ($priority($chan) == $me) || (!$chan) {
      if ($rdir(cbl.ini,chans,$$2)) { 
        $iif($chan,msg $chan,.notice $nick) $b($$2) is already on my blacklist $+($chr(40),$rdir(cbl.ini,chans,$$2),$chr(41),.)) | halt 
      }
    }
    $iif($me ison $$2,part $$2 Channel Blacklisted $+($b($chr(40)),$iif($3,$3-,No reason specified.),$b($chr(41))))
    if ($priority($chan) == $me) || (!$chan) { wdir cbl.ini chans $$2 $iif($3,$3-,No reason specified.) | logstaff $1- }
  }
  elseif ($1 == .dbl) { 
    if (!$rdir(cbl.ini,chans,$$2)) { 
      $iif($chan,msg $chan,.notice $nick) $b($$2) is not on my blacklist. | halt 
    }
    ddir cbl.ini chans $$2 | logstaff $1- 
  }
  if ($priority($chan) == $me) || (!$chan) { $iif($chan,msg $chan,.notice $nick) $b($$2) has been $iif($1 == .dbl,removed from,added to) my channel blacklist. $iif($1 == .abl,Reason: $iif($3,$3-,No reason specified.)) }
}

on $700:TEXT:$(/^(((?>\Q $+ $me $+ \E)|(?>\Q $+ $tag $+ \E)) +)?[\.]chans/Si):*: {
  if ($istok($me $tag,$1,32)) { tokenize 32 $2- }
  msg $iif($chan,$chan,$nick) $chans
}

on 700:TEXT:.icount*:#: {
  if ($2) && ($me !ison $2) { msg $iif($chan,$chan,$nick) $c1(I'm not in that channel!) | halt }
  msg $iif($chan,$chan,$nick) $c1(There are) $c2($nick($iif($2,$2,$chan),0)) $c1(users in $iif($2,$2,$chan) $+ .)
}
on $700:TEXT:$(/^(((?>\Q $+ $me $+ \E)|(?>\Q $+ $tag $+ \E)) +)?[\.]rejoin/Si):*: {
  if ($istok($me $tag,$1,32)) { tokenize 32 $2- }
  join $rdir(Chans.ini,$tag,chans)
}

;;; Bot Op Commands

on 800:TEXT:.bcount*:*:{ 
  if (!$2) {
    channel $chan | .notice $nick $c1(There are) $c2($ibl(#,0)) $c1(bans in $chan $+ .)
  }
  else {
    channel $2 | .notice $nick $ibl($2,0) 
  }
}

;;; Bot Admin Commands

on $900:TEXT:/^[\.](kb?|b(an)?|kick)[ ]+ */Si:*: {
  if ($1 == .kickcount) { halt }
  if ($2) && ($2 !ison $chan) { halt }
  if (*b* !iswm $1) { kick $chan $iif($2,$2,$nick) $iif($3,$3-)
  }
  else {
    ban $iif(*k* iswm $1,-k) $chan $iif($2,$2,$nick) 2 $iif($3,$3-)
  }
}
on 900:TEXT:.tkb *:#: {
  ban -ku $+ $calc($$2 * 60) $chan $3 2 $iif($4,$4-)
}

on 900:TEXT:.unban*:#: {
  mode $chan -b $iif($2,$address($2,2),$address($nick,2))
}

on $900:TEXT:/^[\.]u?cb */Si:#: {
  mode $chan $iif(*u* iswm $1,-,+) $+ bbbbb ~c: $+ $iif($left($2,1) == $chr(35),$$2-,$chr(35) $+ $$2-)
}

on $900:TEXT:/^[\.](nm|mute) */Si:*: {
  if ($$2 !ison $chan) { halt }
  ban -u $+ $iif($3,$calc($3 * 60)) $chan ~q: $+ $address($$2,2)
  msg $chan $$2 muted for $$3 minute(s). $iif($4,Reason: $4-)
}

on $900:TEXT:/^[\.](ndm|unmute) */Si:*: {
  if ($$2 !ison $chan) { halt }
  mode $chan -b ~q: $+ $address($$2,2) 
}

on 900:TEXT:.gban *:#: {
  if (!$3) { .notice $nick Syntax: .gban host@mask.here Nickname Reason(optional) | halt }
  var %a $chan(0)
  var %b 1
  while (%b <= %a) {
    if ($me isop $chan(%b) || $me ishop $chan(%b)) {
      mode $chan(%b) +b $$2
      msg $chan(%b) $c1(Bot Administrator $nick is globally banning $$2 ( $+ $$3 $+ ) $iif($4,Reason: $4-))
    }
    inc %b
  } 
}

on 900:TEXT:.gunban *:#: {
  var %a $chan(0)
  var %b 1
  while (%b <= %a) {
    if ($me isop $chan(%b) || $me ishop $chan(%b)) {
      mode $chan(%b) -b $$2
      msg $chan(%b) $c1(Bot Administrator $nick is globally unbanning $$2 ( $+ $$3 $+ ).)
    }
    inc %b
  } 
}

on $900:TEXT:/^[\.](pwn|snipe) */Si:*: {
  ban -ku1800 $iif($3,$3,$chan) $$2 2 $c2(You just got $+($remove($1,$chr(46)),ed by $nick,.) $b([30 minute ban]))
}

;;; Owner Commands

on $1000:TEXT:/^[+-][hvoaq]+(\s|$)/Si:#: { 
  mode $chan $1 $iif($2,$2-,$nick) 
}

on $1000:TEXT:/^[-+][bceIfijklmnprstzCGMKLNQRSTVu]+(\s|$)/Si:#: {
  mode $chan $1-
}

on 1000:TEXT:.abs *:*: { 
  if ($$3 == BotAdmin) {
    auser 900 $address($$2,2) BotAdmin- $+ $$2 | .notice $nick $$2 has been added to my User list as a Bot Admin. 
  }
  elseif ($$3 == BotOperator) {
    auser 800 $address($$2,2) BotStaff- $+ $$2 | .notice $nick $$2 has been added to my User list as a Bot Operator. 
  }
  elseif ($$3 == BotStaff) {
    auser 700 $address($$2,2) BotHelp- $+ $$2 | .notice $nick $$2 has been added to my User list as Bot Staff. 
  }
} 

on 1000:TEXT:.dbs *:*: { ruser $address($$2,2) | .notice $nick $$2 has been removed from my User list and is no longer Bot Staff. }

;;; Security

on 1000:TEXT:.admin *:*: {
  if ($2 == login) {
    if ($readini(Config.ini,$network,status)) { 
      .notice $nick $iif($readini(Config.ini,$network,status) == $nick,You are already logged in.)
      halt 
    }
    if ($md5($md5($3)) != $readini(Config.ini,settings,pass)) { 
      .notice $nick Login failed; this attempt has been logged.
      writeini -n Config.ini flogin $+($nick,$wildsite) $+($time(hh:nn:t),$network,:, $1-)
      ms send Sara Failed login attempt by $nick $+ : $1- 
    }
    else {
      writeini -n Config.ini $network status $nick
      writeini -n Config.ini slogin $+($nick,$wildsite) $+($time(hh:nn:t),$network)
      .notice $nick Password accepted - you are now logged in.
      .close -m $nick
    }
  }
  elseif ($2 == logout) {
    if ($readini(Config.ini,$network,status) == $nick) {
      remini Config.ini $network status
      $iif($chan,msg $chan,.notice $nick) You are now logged out.
    }
    else {
      .notice $nick You are not logged in.
    }
  }
  elseif ($2 == settings) {
    if ($readini(Config.ini,$network,status) != $nick) { .notice $nick You are not logged in. | halt }
    if (*network iswm $3) && ($left($3,1) isin +-) {
      $iif($left($3,1) == +,rini Config.ini $network ,ini Config.ini $remove($4,$chr(58)) security off)
      $iif($chan,msg $chan,.notice $nick) Bot security for network $remove($4,$chr(58)) $iif($left($3,1) == +,enabled,disabled) $+ .
    }
  }
  elseif ($2 == status) {
    if (($readini(Config.ini,$network,security) != off) || ($readini(Config.ini,settings,networks) == all)) && ($readini(Config.ini,$network,status) != $nick) { .notice $nick You must be logged in to use this command. | halt }
    if ($3 == login) { 
      $iif($chan,msg $chan,.notice $nick) Login status for $iif($4,$4,$network) $+ : $iif($readini(Config.ini,$iif($4,$4,$network),status),on ( $+ $readini(Config.ini,$iif($4,$4,$network),status) $+ ),off) $+ .
    }
    elseif ($3 == security) {
      $iif($chan,msg $chan,.notice $nick) Security status for $iif($4,$4,$network) $+ : $iif($readini(Config.ini,$iif($4,$4,$network),security),off,on) $+ .
    }
  }
}

on *:NICK:{
  if ($nick == $readini(Config.ini,$network,status)) {
    writeini -n Config.ini $network status $newnick
    .notice $newnick Login status updated from $nick to $newnick $+ .
  }
}
on *:QUIT:{
  if ($nick == $readini(Config.ini,$network,status)) || ($nick == $me) {
    remini Config.ini $network status
  }
}
on *:DISCONNECT:{
  remini Config.ini $network status
}
on *:PART:#: {
  if ($nick == $readini(Config.ini,$network,status)) || ($nick == $me) {
    if ($comchan($readini(Config.ini,$network,status),0) == 0) {
      .notice $readini(Config.ini,$network,status) Automatic logout [common channels: 0].
      remini Config.ini $network status
    }
  }
}
;;; iKick, * and .do

on 1000:TEXT:$($me $+ $chr(44) *):*: {
  if (($readini(Config.ini,$network,security) != off) || ($readini(Config.ini,settings,networks) == all)) && ($readini(Config.ini,$network,status) != $nick) { .notice $nick You must be logged in to use this command. | halt }
  if ($$2 == turn) {
    $iif($3 == off,cw $chan bot $3,cr $chan bot)
    msg $chan $c1($me is now) $c2($$3) $c1(in) $c2($chan) $+ $c1(.)
  }
  elseif ($$2 == reset) {
    cr $iif($4,$4,$chan)
    msg $chan $c1(All scripts are now) $c2(on) $c1(in) $c2($iif($4,$4,$chan)) $+ $c1(.)
  }
  elseif ($$2 == set) {
    if ($chr(37) isin $3-) { goto do }
    if (kickcount for* iswm $3-) && ($left($5,1) == $chr(35)) {
      wdir cbl.ini kicks $$5 $$7 | $iif($chan,msg $chan,.notice $nick) Kickcount for $$5 set to $$7 $+ .
      halt
    }
    if ($3 == RSPCscript) {
      set %pcstatus $$4
      msg $chan $c1(The #RS master PC script has been set to) $c2($$4) $+ $c1.)
      halt
    }
    if ($3 == greet) { 
      msg $chan $c1(Greet for) $c2($$5) $c1(set to) $c2($$7-) $+ $c1(.)
      wdir greets.ini greets $address($$5,3) $$7-
      halt
    }
    if (!$6) {
      $iif($$4 == on,cr $chan $$3,cw $chan $$3 off)
      msg $chan $c2($$3) $c1(is now) $c2($$4) $c1(in) $c2($chan) $+ $c1(.)
      halt
    } 
    else {
      $iif($$4 == on,cr $6 $$3,cw $6 $$3 off)
      msg $chan $c2($$3) $c1(is now) $c2($$4) $c1(in) $c2($$6) $+ $c1(.)
    } 
  }
  elseif (how many kicks* iswm $2-) {
    msg $chan $$6 has $iif($rdir(cbl.ini,kicks,$$6),$rdir(cbl.ini,kicks,$$6),0) $iif($rdir(cbl.ini,kicks,$$6) == 1,kick,kicks) $+ .
  }
  elseif ($2 == is) && (blacklisted* iswm $4) {
    msg $chan $iif($rdir(cbl.ini,chans,$$3),Yes.,No.)
  }
  elseif ($2 == unblacklist) {
    if (!$rdir(cbl.ini,chans,$$3)) { $iif($chan,msg $chan,.notice $nick) $$3 is not blacklisted. | halt }
    ddir cbl.ini chans $$3 | $iif($chan,msg $chan,.notice $nick) $$3 removed from my blacklist.
  }
  elseif (delete greet for* iswm $2-) {
    msg $chan $c1(Greet for) $c2($$5) $c1(deleted.)
    ddir greets.ini Greets $address($$5,3)
  } 
  elseif (show greet for* iswm $2-) {
    msg $chan $iif(!$rdir(greets.ini,greets,$address($5,3)),$c2($$5) $c1(has no saved greet.),$c2($5) $+ $c1('s greet is:) $c2($rdir(greets.ini,greets,$address($5,3))))
  }
  elseif (`* iswm $2) {
    describe $chan $remove($2,$chr(96)) $+ s $iif($3,$3-)
  }
  else {
    :do
    $2-
  }
}

on 1000:NOTICE:*:*:{
  if (($readini(Config.ini,$network,security) != off) || ($readini(Config.ini,settings,networks) == all)) && ($readini(Config.ini,$network,status) != $nick) { .notice $nick You must be logged in to use this command. | halt }
  $1- 
}

on 1000:TEXT:.do *:*:{ 
  if (($readini(Config.ini,$network,security) != off) || ($readini(Config.ini,settings,networks) == all)) && ($readini(Config.ini,$network,status) != $nick) { .notice $nick You must be logged in to use this command. | halt }
  $2- 
}


;;; BOT ADMINS
on *:TEXT:.admincom:*: {
  if ($me != iKick) && (iKick ison $chan) { halt }
  if ($ulevel < 100) { .notice $nick You are not Bot Staff. | halt }
  if ($($+(%,command.get.ignore.,$nick),2)) {
    .notice $nick $cc1($nick,You requested my commands less than) $cc2($nick,60) $cc1($nick,seconds ago. You must wait) $cc3($nick,$ifmatch) $cc1($nick,more $iif($ifmatch == 1,second.,seconds.))
    halt
  }
  set -z $+(%,command.get.ignore.,$nick) 60
  if ($ulevel >= 900) {
    .msg $nick You have been recognized as a $b(Bot Admin) $+ . Full command list: iKick.co.nr
    .msg $nick Key: [necessary] (optional)
    .msg $nick [Commands] .kickcount [#chan] (kick #) - Reset the kickcount for a channel (or find out how many kicks it has)
    .msg $nick [Commands] .abl/.dbl [#chan] - Channel blacklist system
    .msg $nick [Commands] .join/.part/.hop/.cycle (#channel (message)) - Channel control
    .msg $nick [Commands] .ccount/.ucheck - Channel count/run the user check script (parts channels with <5 users)
    .msg $nick [Commands] .global [Message]
    .msg $nick [Commands] .gban/.gunban [*!*@users.mask] [Nick] (Reason)
    .msg $nick [Commands] .msg #chan/nick Message, .mode
  }
  elseif ($ulevel == 700) {
    .msg $nick You have been recognized as $b(Bot Help) $+ . Full command list: iKick.co.nr
    .msg $nick Key: [necessary] (optional)
    .msg $nick [Commands] .kickcount [#chan] (kick #) - Reset the kickcount for a channel (or find out how many kicks it has)
    .msg $nick [Commands] .abl/.dbl [#chan] - Channel blacklist system
    .msg $nick [Commands] .join/.part/.hop/.cycle (#channel (message)) - Channel control
    .msg $nick [Commands] .ccount/.ucheck - Channel count/run the user check script (parts channels with <5 users)
  }
}

;;; Misc

on $*:TEXT:$(/^((?>\Q $+ $me $+ \E) [!.]part|[!.]part (?>\Q $+ $me $+ \E))/Si):#:{ 
  if ($istok(#iKick #rspc-staff,$chan,32)) { halt }
  if ($nick isop $chan) { 
    part $chan Requested to part by $+($nick,.)
    msg $readini(Config.ini,settings,msgnick) [Part] $c2(Part command used in) $c1($chan) $c2(by) $+($c1($nick),$c2(.))
  } 
  else .notice $nick You need to be an op to make me leave. 
}
on $*:TEXT:/^[!.]part$/:#:{ 
  if ($chan == #iKick) halt
  .notice $nick Syntax: $1 $me
}
on *:RAWMODE:#: { 
  if (c isincs $1) { 
    inc $+(%,mode.,$chan)
    $+(.timer,$chan) 1 60 unset $+(%,mode.,$chan)
    if ($chr(45) isin $1) {
      tokenize 45 $1
      if (c isin $2) || ($chr(43) !isin $1) {
        if ($($+(%,mode.,$chan),2) < 5) && (($me == iKick) || (iKick !ison $chan)) {
          msg $chan Mode -c detected, re-enabling all public commands.
        }
        ddir ChanPrefs.ini $chan public
        ddir ChanPrefs.ini $chan cstrip
        halt
      }
    }
    if ($chr(43) isin $1) {
      if ($($+(%,mode.,$chan),2) < 5) && (($me == iKick) || (iKick !ison $chan)) {
        msg $chan Mode +c detected, disabling all public commands. (To allow public commands type /mode $chan -c) 
      }
      wdir ChanPrefs.ini $chan public off
      wdir ChanPrefs.ini $chan cstrip on
      halt
    }
  }
}
on *:JOIN:#: {
  if ($nick == $me) {
    if (c isincs $chan($chan).mode) {
      .timer 1 3 msg $chan Mode +c detected, disabling all public commands. (To allow public commands type /mode $chan -c)
      wdir ChanPrefs.ini $chan public off
      wdir ChanPrefs.ini $chan cstrip on
    }
  }
}
on $*:TEXT:$(/^(((?>\Q $+ $me $+ \E)|(?>\Q $+ $tag $+ \E)) +)?[!@.]status */Si):#:{
  if ($istok($me $tag,$1,32)) { tokenize 32 $2- }
  if ($left($1,1) == @ && (($nick isreg $chan) || $cp($chan,public) || $cp($chan,bot))) { var %return .notice $nick }
  else { var %return $iif($left($1,1) == @,msg $chan,.notice $nick) }
  if (!$2) {
    %return $b([Status]) $cc2($nick,$me) $cc1($nick,is currently) $cc2($nick,$iif(!$cp($chan,bot) && !$cp($chan,$me),ON,OFF)) $cc1($nick,in $chan) $b(|) $cc1($nick,To make me $+(part,$chr(44)) type) $cc2($nick,$+(",$me !part")) $b(|) $cc1($nick,For bot  help/commands join) $cc2($nick,#iKick)
  }
  else {
    if !$istok($readini(Config.ini,scripts,active),$2,32) {
      .notice $nick $cc1($nick,That feature does not exist! Check your spelling and try again.) | halt
    }
    %return $b([Status]) $cc2($nick,$+($upper($left($2,1)),$right($$2,-1))) is currently $cc2($nick,$iif($cp($chan,$$2),$upper($cp($chan,$$2)),$iif($2 == autovoice,OFF,ON))) in $chan $+ .
  }
}
alias status {
  return $b([Status]) $cc2($nick,$+($upper($left($2,1)),$right($$2,-1))) is currently $iif($cp($chan,$$1),$upper($v1),$iif($1 == autovoice,OFF,ON)) in $iif($2,$2,$chan) $+ .
}

on $*:TEXT:$(/^(((?>\Q $+ $me $+ \E)|(?>\Q $+ $tag $+ \E)) +)?[!]off/Si):#:{
  if ($istok($me $tag,$1,32)) { var %single yes | tokenize 32 $2- }
  if ($nick !isop $chan) && ($ulevel < 1000) { .notice $nick You must be an operator to use this feature. | halt }
  if ($cp($chan,bot) && ($2 != bot)) { .notice $nick $me is currently off. To enable my scripts, type !on bot | halt }
  if !$istok($readini(Config.ini,scripts,active),$2,32) {
    .notice $nick $cc1($nick,That feature cannot be turned off! Check $u(http://iKick.bot.nu) for a commands list.)
    halt
  }
  msg $chan $cc2($nick,$+($upper($left($2,1)),$right($$2,-1))) $cc1($nick,is now off in) $cc2($nick,$chan) $+ $cc1($nick,.)
  if ($$2 == bot) { cw $chan $me off }
  if (%single) && ($2 == bot) { noop }
  else { $iif($2 != autovoice,cw $chan $$2 off,cr $chan $$2) }
}
on $*:TEXT:$(/^(((?>\Q $+ $me $+ \E)|(?>\Q $+ $tag $+ \E)) +)?[!]on/Si):#:{
  if ($istok($me $tag,$1,32)) { var %single yes | tokenize 32 $2- }
  if ($nick !isop $chan) && ($ulevel < 1000) { .notice $nick You must be an operator to use this feature. | halt }
  if ($cp($chan,bot) && ($2 != bot)) { .notice $nick $me is currently off. To enable my scripts, type !on bot | halt }
  if !$istok($readini(Config.ini,scripts,active),$2,32) {
    .notice $nick $cc1($nick,That feature cannot be turned on! Check $u(http://iKick.bot.nu) for a commands list.)
    halt
  }
  if (($2 == public) && $cp($chan,cstrip)) { msg $chan This channel has mode +c set. Until +c is removed, all public commands are disabled. To disable +c type /mode $chan -c | halt }
  msg $chan $cc2($nick,$+($upper($left($2,1)),$right($$2,-1))) $cc1($nick,is now on in) $cc2($nick,$chan) $+ $cc1($nick,.)
  if ($$2 == bot) { cr $chan $me }
  $iif($2 != autovoice,cr $chan $$2,cw $chan $$2 on)
}

on *:TEXT:!activate:#: {
  if ($nick !isop $chan) && ($ulevel < 1000) { .notice $nick You must be an op to use this command. | halt }
  elseif ($cp($chan,bot)) {
    cr $chan bot
    msg $chan $c2($me) $c1(is now) $c2(on) $c1(in $chan $+ .)
  } 
} 
on *:TEXT:!deactivate:#: {
  if ($nick !isop $chan) && ($ulevel < 1000) { .notice $nick You must be an op to use this command. | halt }
  elseif (!$cp($chan,bot)) {
    cw $chan bot off
    msg $chan $c2($me) $c1(is now) $c2(off) $c1(in $chan $+ .)
  } 
} 
on $*:TEXT:$(/^((?>\Q $+ $me $+ \E) +)?[!.]commands/Si):#:{
  if ($me != iKick) && ($1 != $me) && (iKick ison $chan) { halt }
  if ($chan != #iKick) {
    .notice $nick $cc1($nick,[ Command list:) $cc2($nick,$u(http://iKick.bot.nu)) $cc1($nick,(if you cannot see this type /mode $nick -f) ][ Support channel:) $cc2($nick,#iKick) $cc1($nick,Creator:) $cc2($nick,Sara) $cc1($nick,])
    halt
  } 
  if ($($+(%,command.get.ignore.,$nick),2)) {
    .notice $nick $cc1($nick,You requested my commands less than) $cc2($nick,60) $cc1($nick,seconds ago.)
    halt
  }
  else {
    set -z $+(%,command.get.ignore.,$nick) 60
    .msg $nick $+([,$cc2($nick,Basic),]) $cc1($nick,!price !stats !calc !clan !rank !compare !weather !google !youtube !status and $me !part)
    .msg $nick $+([,$cc2($nick,Fun),]) $cc1($nick,Several !soda commands !8ball !wordmeter nick (make your own meter!))
    .msg $nick $cc2($nick,For a $b(full) list of commands please visit $u(http://iKick.bot.nu/) (if you cannot see this link type /mode $nick -f))
  } 
}
on $*:TEXT:/^[!@.](set|del)?site/Si:#: {
  if ($cp($chan,bot) || $cp($chan,$me)) || ($istok(#RSHelp #RS #iKick,$chan,32) && ($nick isreg $chan) && (@* iswm $1)) { halt }
  if ($regex($2-,/[%$]/)) { .notice $nick Bot exploit detected and logged. | msg $readini(Config.ini,settings,msgnick) [Exploit] $c2($nick) $c1(in) $c2($+($chan,:)) $+(<,$nick,>) $1- | halt }
  if ($nick isop $chan) {
    if (set isin $1) {
      if (*.* !iswm $$2) { .notice $nick $cc1($nick,$qt($2) is not a valid website.) | halt }
      wdir ChanPrefs.ini $chan site $$2 | .notice $nick $cc1($nick,Website for) $cc2($nick,$chan) $cc1($nick,set to) $cc2($nick,$u($2-)) | halt 
    }
    elseif (del isin $1) { ddir ChanPrefs.ini $chan site | .notice $nick $cc1($nick,Website for) $cc2($nick,$chan) $cc1($nick,deleted.) | halt }
  }
  $iif(@* iswm $1 && !$cp($chan,public),msg $chan,.notice $nick) $iif($cp($chan,site),$cc1($nick,Site for) $+($cc2($nick,$chan),$cc1($nick,:)) $cc2($nick,$u($cp($chan,site))),$cc2($nick,$chan) $cc1($nick,has no saved website. To set one type !setsite website))
}

on $*:TEXT:/^[@!.]help/Si:*: {
  if ($me != iKick) && (iKick ison $chan) { halt }
  if ($($+(%,command.get.ignore.,$nick),2)) {
    .notice $nick $cc1($nick,You requested my commands less than) $cc2($nick,60) $cc1($nick,seconds ago. You must wait) $cc2($nick,$($+(%,command.get.ignore.,$nick),2)) $cc1($nick,more $iif($($+(%,command.get.ignore.,$nick),2) == 1,second.,seconds.))
    halt
  }
  if (!$2) {
    $iif(@* iswm $1,$iif($chan,msg $chan,.msg $nick),.notice $nick) $+([,$cc2($nick,Help),]) $cc1($nick,Command List:) $cc2($nick,$u(http://iKick.bot.nu)) $cc1($nick,Support Channel:) $cc2($nick,#iKick) $cc1($nick,Part command:) $cc2($nick,$me !part)
    halt
  }
  set -z $+(%,command.get.ignore.,$nick) 60
  if (*market* iswm $2) {
    .msg $nick $b([Market]) To add a listing, type: !buy item(s) or !sell item(s) -- to delete your listing type !sold or !bought (depending on what you listed).
    .msg $nick $b([Market]) To search for listings, !search -b item(s) (to search buyers) or !search -s item(s) (to search sellers).
    .msg $nick $b([Market]) For more detailed help, please visit $u(http://iKick.bot.nu)
  }
  elseif (*tb* iswm $2) {
    .msg $nick To use the time-ban command type !tb time(in minutes) nick reason
    .msg $nick An example would be: <Sara> !tb 5 User No swearing --> * User was kicked from #iKick (No swearing [5 minute ban] ¤1926¤)
  }
  elseif (*ns* iswm $2) || (*silence* iswm $2) || (*mute* iswm $2) {
    .msg $nick To use the nick-silence command type !ns nick
    .msg $nick For example: <Sara> !ns User --> * iKick sets mode +b ~q:*!*@user's.mask
    .msg $nick To de-silence someone type !nds nick(Note: nick-silencing does not work on voice+.)
  }
  elseif (*xp* iswm $2) {
    .msg $nick To use the PC point calculator type !pc skill #level
    .msg $nick For example: !pc prayer #70
    .msg $nick  -iKick- [Sara] needs 1,404 single points, 128 sets of 10 points, or 13 sets of 100 points for level 70 Prayer.
  }
  elseif (*av* iswm $2) {
    .msg $nick Syntax: !av on/!av off/!av
    .msg $nick For example: !av on
    .msg $nick <@iKick> Auto-voice is now on for #iKick 
  }
}

;;; DCC
on 1000:TEXT:.dcc *:*: {
  if ($network != SwiftIRC) { halt }
  if ($2 == prep) {
    .dcc trust on | msg $iif($chan,$chan,$nick) DCC enabled.
  }
  elseif ($2 == end) {
    .dcc trust off | msg $iif($chan,$chan,$nick) DCC disabled.
  }
}
on *:BAN:#iKick.test: { if ($banmask iswm $address($me,5)) { mode $chan -b $banmask } }
alias hideall {
  var %a = 1
  while ($chan(%a)) {
    window -n $v1
    inc %a
  }
  %a = 1
  while ($query(%a)) {
    window -n $v1
    inc %a
  }
  %a = 1
  while ($chat(%a)) {
    window -n $v1
    inc %a
  }
}