Pages

Saturday, August 27, 2011

juwi.tcl

##############################################################
#  Created by :                                      #
#                      jurig                       #
#                  jurig@gank-bandung.org                    #
#             Dino R Natadijaya              #
#       #gank-bandung allnetwork  www.gank-bandung.org         #
#                                                            #
##############################################################

set CC "-"
set timezone "WIB"
set nopart "#watulimo"
set topicnick 0
set spychan $nopart
setudef flag spy

############################################################
############# DON'T CHANGE BELOW THIS LINE!!!! #############
############################################################

bind msg p|p auth msg_auth
bind msg p|p deauth msg_deauth
bind sign p|p * sign_deauth
bind part p|p * part_deauth

proc botname {} {global botname;return $botname}

bind pub o|o ${CC}match pub_match
bind pub m ${CC}+ban pub_+ban
bind pub m ${CC}ban pub_ban
bind pub m ${CC}kb pub_kb
bind pub m ${CC}kickban pub_kickban
bind pub m ${CC}-ban pub_-ban
bind pub m ${CC}bans pub_bans
bind pub m ${CC}resetbans pub_resetbans
bind pub o|o ${CC}notice pub_notice
bind pub o|o ${CC}op pub_op
bind pub o|o ${CC}deop pub_deop
bind pub o|o ${CC}voice pub_voice
bind pub o|o ${CC}devoice pub_devoice
bind pub o|o ${CC}topic pub_topic
bind pub o|o ${CC}act pub_act
bind pub o|o ${CC}say pub_say
bind pub o|o ${CC}msg pub_msg
bind pub o|o ${CC}invite pub_invite
bind pub m|m ${CC}nick pub_nick
bind pub o|o ${CC}servers pub_servers
bind pub p|p ${CC}channel pub_channel
bind pub p|p ${CC}time pub_time
bind pub o|o ${CC}kick pub_kick
bind pub o|o ${CC}k pub_k
bind pub p|p ${CC}channels pub_channels
bind pub o|o ${CC}+t mode_+t
bind pub o|o ${CC}+n mode_+n
bind pub o|o ${CC}+s mode_+s
bind pub n|n ${CC}+i mode_+i
bind pub o|o ${CC}+p mode_+p
bind pub m|m ${CC}+m mode_+m
bind pub n|n ${CC}+k mode_+k
bind pub n|n ${CC}+l mode_+l
bind pub o|o ${CC}+v mode_+v
bind pub o|o ${CC}-v mode_-v
bind pub o|o ${CC}-t mode_-t
bind pub o|o ${CC}-s mode_-s
bind pub n|n ${CC}-l mode_-l
bind pub n|n ${CC}-k mode_-k
bind pub m|m ${CC}-m mode_-m
bind pub n|n ${CC}-i mode_-i
bind pub o|o ${CC}-n mode_-n
bind pub o|o ${CC}-p mode_-p
bind pub n ${CC}adduser pub_adduser
bind pub n ${CC}+user pub_+user
bind pub n ${CC}-user pub_-user
bind pub n ${CC}deluser pub_deluser
bind pub p ${CC}+host pub_+host
bind pub p ${CC}-host pub_-host
bind pub n ${CC}chattr pub_chattr
bind pub m ${CC}save pub_save
bind pub m ${CC}+ignore pub_+ignore
bind pub m ${CC}-ignore pub_-ignore
bind pub m ${CC}ignores pub_ignores
bind pub m ${CC}reload pub_reload
bind pub n ${CC}jump pub_jump
bind pub n ${CC}rehash pub_rehash
bind pub n ${CC}restart pub_restart
bind pub n ${CC}join pub_join
bind pub n ${CC}part pub_part
bind pub n ${CC}chaddr pub_chaddr
bind pub m ${CC}status pub_status
bind pub m ${CC}chaninfo pub_chaninfo
bind pub n ${CC}dccstat pub_dccstat
bind pub n ${CC}botnick pub_botnick
bind pub n ${CC}realnick pub_realnick
bind pub n ${CC}die pub_die
bind pub n ${CC}chanset pub_chanset
bind pub n ${CC}chansave pub_chansave
bind pub n ${CC}chanload pub_chanload
bind pub n ${CC}+chan pub_+chan
bind pub n ${CC}-chan pub_-chan
bind pub o|o ${CC}userlist pub_userlist
bind pub o|o ${CC}up pub_up
bind pub o|o ${CC}down pub_down
bind pub n ${CC}ban pub_ban
bind pub p|p ${CC}access pub_access

bind pub n ${CC}mub pub_massunban
bind pub n ${CC}mop pub_massop
bind pub n ${CC}mdeop pub_massdeop
bind pub n ${CC}mkick pub_masskick
bind pub n ${CC}mvoice pub_massvoice
bind pub n ${CC}mdevoice pub_massdevoice

bind PUB n ${CC}schan pub_setchan

############################################################# msg cmd auth/deauth/sign/part -- start
proc msg_auth {nick uhost hand rest} {
 global botnick
 set pw [lindex $rest 0]
 if {$pw == ""} {
  puthelp "NOTICE $nick : Usage: /msg $botnick auth <password>"
  return 0
 }
 if {[matchattr $hand Q] == 1} {
  puthelp "NOTICE $nick : Already authenticated!"
  return 0
 }
 set ch [passwdok $hand ""]
 if {$ch == 1} {
  puthelp "NOTICE $nick : No password set. Type /msg $botnick pass <password>"
  return 0
 }
 if {[passwdok $hand $pw] == 1} {
  chattr $hand +Q
  puthelp "NOTICE $nick : Successfully authenticated!"
 }
 if {[passwdok $hand $pw] == 0} {
  puthelp "NOTICE $nick : Wrong password!"
 }
}

proc msg_deauth {nick uhost hand rest} {
 global botnick
 if {$rest == ""} {
  puthelp "NOTICE $nick : Usage: /msg $botnick auth <password>"
  return 0
 }
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : You never authenticated!"
  return 0
 }
 if {[passwdok $hand $rest] == 1} {
  chattr $hand -Q
  puthelp "NOTICE $nick : DeAuthentication successful!"
 }
 if {[passwdok $hand $rest] == 0} {
  puthelp "NOTICE $nick : DeAuthentication failed!"
 }
}

proc sign_deauth {nick uhost hand chan rest} {
 if {[matchattr $hand Q] == 1} {
  chattr $hand -Q
 }
 if {[matchattr $hand Q] == 0} {
  return 0
 }
}

proc part_deauth {nick uhost hand chan rest} {
  if {[matchattr $hand Q] == 1} {
  chattr $hand -Q
 }
 if {[matchattr $hand Q] == 0} {
  return 0
 }
}
############################################################# msg cmd auth/deauth/sign/part -- stop

######################################################### modes via pubic cmd -- start
proc mode_+v {nick uhost hand chan rest} { 
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 if {$rest == ""} {
  puthelp "NOTICE $nick : Usage: ${CC}+v <nick>"
  return 0
 }
 if {[onchan $rest $chan] == 0} {
  puthelp "NOTICE $nick : $rest is not on the channel."
  return 0
 }
 if {[isvoice $rest $chan] == 1} {
  puthelp "NOTICE $nick : $rest is already +v"
 }
 if {[onchan $rest $chan] == 1} {
  pushmode $chan +v $rest
 }
}

proc mode_-v {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
}
 if {$rest == ""} {
  puthelp "NOTICE $nick : Usage: ${CC}-v <nick>"
  return 0
 }
 if {[onchan $rest $chan] == 0} {
  puthelp "NOTICE $nick : $rest is not on the channel."
  return 0
 }
 if {[isvoice $rest $chan] == 1} {
  puthelp "NOTICE $nick : $rest is already -v"
 }
 if {[onchan $rest $chan] == 1} {
  pushmode $chan -v $rest
 }
}

proc mode_+t {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan +t
}

proc mode_-t {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan -t
}

proc mode_+s {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan +s-p
}

proc mode_-s {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan -s
}

proc mode_+p {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan +p-s
}

proc mode_-p {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan -p
}

proc mode_+n {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan +n
}

proc mode_-n {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan -n
}

proc mode_+i {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan +i
}

proc mode_-i {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan -i
}

proc mode_+m {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan +m
}

proc mode_-m {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan -m
}

proc mode_+l {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 if {$rest == ""} {
  puthelp "NOTICE $nick : Usage: ${CC}+l <limit>"
  return 0
 }
 pushmode $chan +l $rest
}

proc mode_-l {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan -l $rest
}

proc mode_+k {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 if {$rest == ""} {
  puthelp "NOTICE $nick : Usage: ${CC}+k <key>"
  return 0
 }
 pushmode $chan +k $rest
}

proc mode_-k {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 pushmode $chan -k $rest
}

proc mode_+b {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 if {$rest == ""} {
  puthelp "NOTICE $nick : Usage: ${CC}+b <hostmask>"
  return 0
 }
 pushmode $chan +b $rest
}

proc mode_-b {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 if {$rest == ""} {
  puthelp "NOTICE $nick : Usage: ${CC}-b <hostmask>"
  return 0
 }
 pushmode $chan -b $rest
}
############################################################# modes via pubic cmd -- stop

## public cmd notice -- start
proc pub_notice {nick uhost hand channel rest} {
 set person [lindex $rest 0]
 set rest [lrange $rest 1 end]
 if {$rest!=""} {
  puthelp "NOTICE $person :$rest"
  return 0
 }
 if {$rest==""} {
  puthelp "NOTICE $nick : Usage: ${CC}notice <nick> <msg>"
 }
}
## public cmd notice -- stop

## public cmd massunban -- start
proc pub_massunban {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 set chan [lindex $rest 0]
 if {$chan == ""} {
  putdcc $idx " Gunakan: ${CC}massunban <#channel>"
  return 1
 }
 foreach bansHr [chanbans $rest] {pushmode $rest -b [lindex $bansHr 0]}
}
## public cmd massunban -- stop

## public cmd dccstat -- start
proc pub_dccstat {nick uhost hand chan rest} {
 set socksp "    ";set usersp "         ";set hostsp "                 "
 puthelp "NOTICE $nick : SOCK NICK      HOST              TYPE"
 puthelp "NOTICE $nick : ---- --------- ----------------- ----"
 foreach info [dcclist] {
   set sock [lindex $info 0]
   set user [lindex $info 1]
   set host [lindex $info 2]
   set type [lindex $info 3]
   if {[string length $sock] < 4} {
     set socksize [expr [string length $socksp]-[string length $sock]]
     set newsocksp [string range $socksp 0 [expr $socksize - 1]]
     set sock "${sock}${newsocksp}"
   }
   if {[string length $user] < 9} {
     set usersize [expr [string length $usersp]-[string length $user]]
     set newusersp [string range $usersp 0 [expr $usersize - 1]]
     set user "${user}${newusersp}"
   }
   if {[string length $user] > 9} {set user [string range $user 0 8} 
   if {[string length $host] < 17} {
     set hostsize [expr [string length $hostsp]-[string length $host]]
     set newhostsp [string range $hostsp 0 [expr $hostsize - 1]]
     set host "${host}${newhostsp}"
   }
   if {[string length $host] > 17} {
     set hostsize [expr [string length $host] -17]
     set host [string range $host $hostsize end]
   }
   if {$type == "TELNET"} {set type "lstn"}
   set type [string range [string tolower $type] 0 3]
   puthelp "NOTICE $nick : $sock $user $host $type"
 }
}
## public cmd dccstat -- stop


## public cmd -chan -- stop
proc pub_-chan {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 set channel [lindex $rest 0]
 if {$channel == ""} {
  puthelp "NOTICE $nick : Usage: ${CC}+chan <#channel>"
  return 0
 }
 if {[string first # $channel]!=0} {
  set channel "#$channel"
 }
 if {[validchan $channel]} {
  channel remove $channel
  puthelp "NOTICE $nick : Channel $channel removed from the bot."
  puthelp "NOTICE $nick : This includes any channel specific bans you set."
 } else {
  puthelp "NOTICE $nick : That channel doesnt exist!"
 }
}
## public cmd -chan -- stop

## public cmd +chan -- start
proc pub_+chan {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 set channel [lindex $rest 0]
 set options [lindex $rest 1]
 if {$channel == ""} {
  puthelp "NOTICE $nick : Usage: ${CC}+chan <#channel> \[option-list\]"
  return 0
 }
 if {[validchan $channel]} {
  puthelp "NOTICE $nick : Your already in $channel"
 } else {
  if {[string first # $channel]!=0} {
   set channel "#$channel"
  }
 channel add $channel $options
 }
}
## public cmd +chan -- stop

## public cmd resetbans -- start
proc pub_resetbans {nick uhost hand channel rest} {
 global CC botnick
 set chan $rest
 if {$chan != ""} {
  if {[validchan $chan]} {
   foreach ban [banlist $chan] {
    pushmode $chan +b [lindex $ban 0]
   }
   putserv "MODE $chan -b"
   puthelp "NOTICE $nick : Resetting bans on $chan..."
   return 0
  } else {
   puthelp "NOTICE $nick : $chan is an invalid channel."
   return 0
  }
 }
 if {$chan == ""} {
  foreach ban [banlist] {
   foreach i [channels] {
    pushmode $i +b [lindex $ban 0]
    puthelp "NOTICE $nick : Resetting bans on $i"
   }
  }
  foreach x [channels] {
   putserv "MODE $x +b"
  }
 }
}
## public cmd resetbans -- stop

## public cmd chanload -- start
proc pub_chanload {nick uhost hand chan rest} {
 global botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 loadchannels
 puthelp "NOTICE $nick : Reloading all dynamic channel settings."
}
## public cmd chanload -- stop

## public cmd chansave -- start
proc pub_chansave {nick uhost hand chan rest} {
 global botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 puthelp "NOTICE $nick : Saving all dynamic channel settings."
 savechannels
 puthelp "NOTICE $nick : Writing channel file ..."
}
## public cmd chansave -- stop

## public cmd chanset -- start
proc pub_chanset {nick uhost hand chan rest} {
 global CC botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
 set channel [lindex $rest 0]
 set options [lindex $rest 1]
 if {($channel == "") || ($options == "")} {
  puthelp "NOTICE $nick : Usage: ${CC}chanset #<channel> <option...>"
  return 0
 }
 if {[validchan $channel]} {
  channel set $channel $options
  puthelp "NOTICE $nick : Successfully set modes \{ $options \} on $channel"
  puthelp "NOTICE $nick : Changes to $channel are not permanent."
 } else {
  puthelp "NOTICE $nick : No such channel."
 }
}
## public cmd chanset -- stop

## pubic cmd restart -- start
proc pub_restart {nick uhost hand chan rest} {
 global botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
  utimer 1 restart
  puthelp "NOTICE $nick : Writing user file... Writing channel file ... Restarting ..."
}
## public cmd restart -- stop

## pubic cmd rehash -- start
proc pub_rehash {nick uhost hand chan rest} {
 global botnick
 if {[matchattr $hand Q] == 0} {
  puthelp "NOTICE $nick : Auth Dolo Dunk. Please /msg $botnick auth <password>"
  return 0
 }
  utimer 1 rehash
  puthelp "NOTICE $nick : Writing user & channel file... Rehashing.. Userfile loaded, unpacking..."
}
## public cmd rehash -- stop

## public cmd chaninfo -- start
proc pub_chaninfo {nick uhost hand chan rest} {
 global CC
 if {$rest == ""} {
  puthelp "NOTICE $nick : Usage: ${CC}chaninfo <#channel>"
  return 0
 }
 if {[validchan $rest]} {
  set em [lindex [channel info $rest] 0]
  puthelp "NOTICE $nick : Settings for static channel $rest"
  set em [lindex [channel info $rest] 0]
  puthelp "NOTICE $nick : Protect modes (chanmode): $em"
 if {[lindex [channel info $rest] 1] == "0"} {
  puthelp "NOTICE $nick : Idle Kick after (idle-kick): DONT!"
 } else {
  puthelp "NOTICE $nick : Idle Kick after (idle-kick): [lindex [channel info $rest] 1] min"
 }
  puthelp "NOTICE $nick : Other modes:"
  puthelp "NOTICE $nick :      [lindex [channel info $rest] 12]  [lindex [channel info $rest] 13]  [lindex [channel info $rest] 14]  [lindex [channel info $rest] 15]"
  puthelp "NOTICE $nick :      [lindex [channel info $rest] 16]     [lindex [channel info $rest] 17]        [lindex [channel info $rest] 18]        [lindex [channel info $rest] 19]"
  puthelp "NOTICE $nick :      [lindex [channel info $rest] 20]  [lindex [channel info $rest] 21]  [lindex [channel info $rest] 22]      [lindex [channel info $rest] 23]"
  puthelp "NOTICE $nick :      [lindex [channel info $rest] 24]      [lindex [channel info $rest] 25]   [lindex [channel info $rest] 26]"
  set ichan [lindex [channel info $rest] 7]
  set ictcp [lindex [channel info $rest] 8]
  set ijoin [lindex [channel info $rest] 9]
  set ikick [lindex [channel info $rest] 10]
  s

No comments:

Post a Comment