set global-flood-chan 0:0 set global-flood-deop 0:0 set global-flood-kick 0:0 set global-flood-join 0:0 set global-flood-ctcp 0:0 set global-flood-nick 0:0 bind pub - @access pub_access bind pub - @a pub_access bind pub - @adduser pub_adduser bind pub - @addowner pub_addowner bind pub - @addcoowner pub_addcoowner bind pub - @addmaster pub_addmaster bind pub - @addop pub_addop bind pub - @addpeon pub_addpeon bind pub - @reg pub_register bind pub - @register pub_getabot bind pub - @unreg pub_unregister bind pub - @removeabot pub_removeabot bind pub - @suspend pub_suspend bind pub - @unsuspend pub_unsuspend bind pub - @deluser pub_deluser bind pub - @god pub_god bind pub - @listusers pub_users bind pub - @set pub_set bind pub - @god pub_god bind pub - @liststaff pub_liststaff bind pub - @die pub_die bind pub - @botrehash pub_botrehash bind pub - @botrestart pub_restart bind pub - @global pub_global bind pub - @aglobal pub_aglobal bind pub - @say pub_say bind pub n @addcmd add:command bind pub n @commands count:command bind pub n @delcmd del:command bind pub n ?oset oset bind pub n ?hire hire bind msg - register auth_register bind msg - auth auth_auth bind chof - * partylogo bind ctcr - * ctcp:priv bind link - * botlink bind disc - * botdisc bind chon - * partylogi bind flud - * flooding bind filt - .quit* partylogou bind join - "*" on_join_staff bind pub n -fix2 pub_fix2 proc pub_access {nick host hand chan who} { global botnick if {$who == ""} {set who $nick} if {$who == "$botnick"} {notice $nick "$who is a AvidBot (\002Administrator\002)." ; notice $nick "$who is the \002Moderator\002 in $chan and has \002security override\002 enabled." ; return } set newhand [finduser $who![getchanhost $who $chan]] if {$newhand == "*"} {notice $nick "\002$who\002 is not registered with \002\00314PenguinBot\0031\002." ; return } if {[getuser $newhand XTRA epithet] == ""} { set epithet "PenguinBot" } else { set epithet [getuser $newhand XTRA epithet] } if { [staff $newhand] && [godmode $newhand] } { notice $nick "$who ($newhand) has an access level of [saccess $newhand $chan] in $chan." notice $nick "$who is a(n) \002[oaccess $newhand]\002 of $epithet." } elseif { [staff $newhand] && ![godmode $newhand] } { notice $nick "$who ($newhand) has an access level of [saccess $newhand $chan] in $chan." notice $nick "$who is a(n) \002[oaccess $newhand]\002 of $epithet." } else { notice $nick "$who ($newhand) has an access level of [saccess $newhand $chan] in $chan." } if { [getchaninfo $newhand $chan] != "" } { notice $nick "\[$newhand\] [getchaninfo $newhand $chan]" } return } proc pub_adduser {nick host hand chan arg} { global botnick set who [lindex $arg 0] set access [lindex $arg 1] if {$who == ""} {notice $nick "\002adduser\002 requires more parameters." ; return} if {$access == ""} {notice $nick "\002adduser\002 requires more parameters." ; return} if { [string index [lindex $arg 0] 0] == "*" } { set user [string range [lindex $arg 0] 1 end] } else { set user [finduser $who![getchanhost $who $chan]] } if {$user == "*"} {notice $nick "\002$user\002 must first register with \002PenguinBot\002." ; return } { if {$access != "4" && $access != "3" && $access != "2" && $access != "1"} {notice $nick "\002$access\002 is an invalid access level" ; return} if {[matchattr $user |NCMOP $chan]} {notice $nick "$who is already on the $chan user list (with [saccess2 $user $chan] access)." ; return} if {$access == "4"} { if {[godmode $hand] == 0 && [accessint $hand $chan] != 5} {noaccess $chan $nick ; return} if {[matchattr $hand I|N $chan]} {chattr $user |+C $chan ; notice $nick "Added $user with \002$access\002 to $chan user list." ; return} } elseif {$access == "3"} { if {[godmode $hand] == 0 && [accessint $hand $chan] < 4} {noaccess $chan $nick ; return} if {[matchattr $hand I|NC $chan]} {chattr $user |+M $chan ; notice $nick "Added $user with \002$access\002 to $chan user list." ; return} } elseif {$access == "2"} { if {[godmode $hand] == 0 && [accessint $hand $chan] < 3} {noaccess $chan $nick ; return} if {[matchattr $hand I|NCM $chan]} {chattr $user |+O $chan ; notice $nick "Added $user with \002$access\002 to $chan user list." ; return} } elseif {$access == "1"} { if {[godmode $hand] == 0 && [accessint $hand $chan] < 2} {noaccess $chan $nick ; return} if {[matchattr $hand I|MCNO $chan]} {chattr $user |+P $chan ; notice $nick "Added $user with \002$access\002 to $chan user list." ; return} } } } proc pub_addowner {nick host hand chan arg} { global botnick if {[godmode $hand] == 0} {nooverride $nick ; return} if { [string index [lindex $arg 0] 0] == "*" } { set user [string range [lindex $arg 0] 1 end] } else { set user [finduser $arg![getchanhost $arg $chan]] } if {$user == "*"} {notice $nick "\002$user\002 must first register with \002PenguinBot\002." ; return } { if {[matchattr $user |NCMOP $chan]} {notice $nick "$arg is already on the $chan user list (with [saccess2 $user $chan] access)." ; return} chattr $user |+N $chan ; notice $nick "Added $user to the $chan user list with access \0025\002." ; cmdlog $chan $nick $hand "addowner $user" ; return} } proc pub_addcoowner {nick host hand chan arg} { global botnick if {[godmode $hand] == 0 && [accessint $hand $chan] != 5} {noaccess $chan $nick ; return} if {[matchattr $hand I|N $chan]} { if { [string index [lindex $arg 0] 0] == "*" } { set user [string range [lindex $arg 0] 1 end] } else { set user [finduser $arg![getchanhost $arg $chan]] } if {$user == "*"} {notice $nick "\002$user\002 must first register with \002PenguinBot\002." ; return } { if {[matchattr $user |NCMOP $chan]} {notice $nick "$arg is already on the $chan user list (with [saccess2 $user $chan] access)." ; return} chattr $user |+C $chan ; notice $nick "Added $user to the $chan user list with access \0024\002." ; return} } } proc pub_addmaster {nick host hand chan arg} { global botnick if {[godmode $hand] == 0 && [accessint $hand $chan] < 4} {noaccess $chan $nick ; return} if {[matchattr $hand I|NC $chan]} { if { [string index [lindex $arg 0] 0] == "*" } { set user [string range [lindex $arg 0] 1 end] } else { set user [finduser $arg![getchanhost $arg $chan]] } if {$user == "*"} {notice $nick "\002$user\002 must first register with \002PenguinBot\002." ; return } { if {[matchattr $user |NCMOP $chan]} {notice $nick "$arg is already on the $chan user list (with [saccess2 $user $chan] access)." ; return} chattr $user |+M $chan ; notice $nick "Added $user to the $chan user list with access \0023\002." ; return} } } proc pub_addop {nick host hand chan arg} { global botnick if {[godmode $hand] == 0 && [accessint $hand $chan] < 3} {noaccess $chan $nick ; return} if {[matchattr $hand I|NCM $chan]} { if { [string index [lindex $arg 0] 0] == "*" } { set user [string range [lindex $arg 0] 1 end] } else { set user [finduser $arg![getchanhost $arg $chan]] } if {$user == "*"} {notice $nick "\002$user\002 must first register with \002PenguinBot\002." ; return } { if {[matchattr $user |NCMOP $chan]} {notice $nick "$arg is already on the $chan user list (with [saccess2 $user $chan] access)." ; return} chattr $user |+O $chan ; notice $nick "Added $user to the $chan user list with access \0022\002." ; return} } } proc pub_addpeon {nick host hand chan arg} { global botnick if {[godmode $hand] == 0 && [accessint $hand $chan] < 2} {noaccess $chan $nick ; return} if {[matchattr $hand I|MCNO $chan]} { if { [string index [lindex $arg 0] 0] == "*" } { set user [string range [lindex $arg 0] 1 end] } else { set user [finduser $arg![getchanhost $arg $chan]] } if {$user == "*"} {notice $nick "\002$user\002 must first register with \002PenguinBot\002." ; return } { if {[matchattr $user |NCMOP $chan]} {notice $nick "$arg is already on the $chan user list (with [saccess2 $user $chan] access)." ; return} chattr $user |+P $chan ; notice $nick "Added $user to the $chan user list with access \0021\002." ; return} } } setudef flag toys setudef str registrar setudef int regon proc pub_getabot {nick uhost hand chan arg} { global botnick if {[godmode $hand] == 0} {nooverride $nick ; return} set args [cleanarg $arg] set thechan [lindex $args 0] set who [lindex $args 1] #set newchan $chan if {$thechan == ""} {notice $nick "\002getabot\002 requires more parameters." ; return} if {$who == ""} {notice $nick "\002getabot\002 requires more parameters." ; return} if { [string index [lindex $args 1] 0] == "*" } { set owner [string range [lindex $args 1] 1 end] } else { set owner [finduser $who![getchanhost $who $chan]] } set owner [finduser $who![getchanhost $who $chan]] if {![validuser $owner]} {notice $nick "\002$who\002 is not a valid nick or account." ; return} notice $nick "Registered \002$thechan\002 to \002$owner\002 by $nick." channel add $thechan file mkdir data/$thechan;set fp [open data/$thechan/sets w+] puts $fp "greeting *" puts $fp "greeting2 *" close $fp chattr $owner |+N $thechan channel set $thechan registrar $hand channel set $thechan regon [unixtime] cmdlog $thechan $nick $hand "register $owner" } proc pub_removeabot {nick uhost hand chan args} { if {[godmode $hand] == 0} {nooverride $nick ; return} if {![validchan $args]} {notice $nick "\002removeabot\002 requires more parameters." ; return} set thechan [lindex $args 0] notice $nick "unregistered \002$thechan\002." putquick "PART $thechan :$thechan unregistered by $nick." channel remove $thechan file delete data/$thechan/sets;file delete data/$thechan cmdlog $thechan $nick $hand "unregister" } proc pub_suspend {nick uhost hand chan arg} { global botnick if {[godmode $hand] == 0} {nooverride $nick ; return} set args [cleanarg $arg] set thechan [lindex $arg 0] set reason [lrange $arg 1 end] if {$thechan == ""} {notice $nick "\002suspend\002 requires more parameters." ; return} if {$reason == ""} {notice $nick "\002csuspend\002 requires more parameters." ; return} notice $nick "\002$botnick\002's access to \002$thechan\002 has been temporarily suspended." putquick "PART $thechan :\002Suspended\002: $reason" channel set $thechan +inactive cmdlog $thechan $nick $hand "suspend $reason" } proc pub_unsuspend {nick uhost hand chan arg} { global botnick if {[godmode $hand] == 0} {nooverride $nick ; return} set thechan [lindex $arg 0] if {$thechan == ""} {notice $nick "\002cunsuspend\002 requires more parameters." ; return} if {[channel get $thechan inactive]} { notice $nick "\002$botnick\002's access to \002$thechan\002 has been restored by $nick." channel set $thechan -inactive cmdlog $thechan $nick $hand "unsuspend" } } proc pub_deluser {nick host hand chan arg} { if { [string index [lindex $arg 0] 0] == "*" } { set user [string range [lindex $arg 0] 1 end] } else { set user [finduser $arg![getchanhost $arg $chan]] } if {![validuser $user]} {notice $nick "\002deluser\002 requires more parameters." ; return} if {[godmode $hand] == 0 && [accessint $hand $chan] <= [accessint $user $chan]} {noaccess $chan $nick ; return} notice $nick "Deleted $user (with [saccess2 $user $chan] access) from the $chan user list." ; chattr $user |-CMOP $chan } proc pub_users {nick host hand chan arg} { if {$arg == ""} { set thechan $chan putquick "notice $nick :\002$thechan\002 user list:" if { [set users [userlist |N $thechan]] == "" } { set users "" } if { [set users1 [userlist |C $thechan]] == "" } { set users1 "" } if { [set users2 [userlist |M $thechan]] == "" } { set users2 "" } if { [set users3 [userlist |O $thechan]] == "" } { set users3 "" } if { [set users4 [userlist |P $thechan]] == "" } { set users4 "" } putquick "notice $nick :\0025:\002 [join $users] \0024:\002 [join $users1] \0023:\002 [join $users2] \0022:\002 [join $users3] \0021:\002 [join $users4]" } else { set thechan $arg putquick "notice $nick :\002$thechan\002 user list:" if { [set users [userlist |N $thechan]] == "" } { set users "" } if { [set users1 [userlist |C $thechan]] == "" } { set users1 "" } if { [set users2 [userlist |M $thechan]] == "" } { set users2 "" } if { [set users3 [userlist |O $thechan]] == "" } { set users3 "" } if { [set users4 [userlist |P $thechan]] == "" } { set users4 "" } putchan $chan "\0025:\002 [join $users] \0024:\002 [join $users1] \0023:\002 [join $users2] \0022:\002 [join $users3] \0021\002 [join $users4]" } } proc pub_set {nick uhost hand chan arg} { set what [lindex $arg 0];set ar [lrange $arg 1 end] switch $what { "greeting" {setgreet $ar $chan $nick $hand} "greeting2" {setgreet2 $ar $chan $nick $hand} default {pub_set2 $nick $uhost $hand $chan $arg} } } proc setgreet {trig chan nick hand} { if {[godmode $hand] == 0 && [accessint $hand $chan] < 3} {noaccess $chan $nick ; return} set t $trig;set aa "";set fp [open data/$chan/sets r] while {![eof $fp]} { gets $fp aa if {![string equal -nocase [lindex [split $aa] 0] greeting]} { if {[info exists aa]&&$aa!=""} {lappend allEntrys $aa} } else {lappend allEntrys "[lindex [split $aa] 0] [join $t]"} } close $fp;set fp [open data/$chan/sets w];foreach aa $allEntrys {puts $fp $aa};close $fp putnot $nick "\002Greeting\002 set to: $t" } proc setgreet2 {trig chan nick hand} { if {[godmode $hand] == 0 && [accessint $hand $chan] < 3} {noaccess $chan $nick ; return} set t $trig;set aa "";set fp [open data/$chan/sets r] while {![eof $fp]} { gets $fp aa if {![string equal -nocase [lindex [split $aa] 0] greeting]} { if {[info exists aa]&&$aa!=""} {lappend allEntrys $aa} } else {lappend allEntrys "[lindex [split $aa] 0] [join $t]"} } close $fp;set fp [open data/$chan/sets w];foreach aa $allEntrys {puts $fp $aa};close $fp putnot $nick "\002Greeting2\002 set to: $t" } proc pub_set2 {nick uhost hand chan arg} { putquick "NOTICE $nick :\002Greeting\002 : \002Greeting2\002" ; return} proc on_join_staff { nick host hand chan } { global channel official global botnick if {$chan == "#avidBots"} {return} if {[staff $hand]} { putchan $chan "$nick is recognized as a \002AvidBots Staff Member\002." putserv "mode $chan +v $nick" } if {$nick == $botnick} { putquick "MODE $chan +o $botnick" } } proc getsets {chan what} { set what [lindex $what 0];set fp [open data/$chan/sets r] while {![eof $fp]} { gets $fp aa if {[string equal -nocase [lindex [split $aa] 0] $what]} { if {[info exists aa]&&$aa!=""} {set ans $aa} } } close $fp return [lrange $ans 1 end] } proc uhg_filter {nick uhost hand chan q} { regsub -all "\{" $q "" q regsub -all "\}" $q "" q regsub -all "\\\%rnick%" $q "[r_nick $chan]" q regsub -all "\\\%nick%" $q $nick q regsub -all "\\\%date%" $q "[ctime [unixtime]]" q regsub -all "\\\%hand%" $q $hand q regsub -all "\\\%host%" $q $uhost q regsub -all "\\\%chan%" $q $chan q return $q } proc r_nick {chan} {set randn [lindex [split [chanlist "$chan"]] [rand [llength [split [chanlist "$chan"]]]]];return $randn} proc staff { hand } { if { [matchattr $hand AHN] } { return 1 } else { return 0 } } proc putchan {chan msg} { set what "[join [split $msg]]" ; putquick "PRIVMSG $chan :\002\002$what" } proc putnot {nick msg} { putquick "NOTICE $nick :$msg" } proc oaccess { hand } { if { [matchattr $hand K] } { return "Senior Administrator" } if { [matchattr $hand S] } { return "Administrator" } if { [matchattr $hand X] } { return "Techincal Support" } if { [matchattr $hand Z] } { return "Support" } if { [matchattr $hand B] } { return "Beta Staff" } return Basic } proc staff { hand } { if { [matchattr $hand SAATSSBS] } { return 1 } else { return 0 } } proc accessint { hand chan } { if { [matchattr $hand |N $chan] } { return 5 } if { [matchattr $hand |C $chan] } { return 4 } if { [matchattr $hand |M $chan] } { return 3 } if { [matchattr $hand |O $chan] } { return 2 } if { [matchattr $hand |P $chan] } { return 1 } return 0 } proc saccess { hand chan } { if { [matchattr $hand |N $chan] } { return "has \0025\002" } if { [matchattr $hand |C $chan] } { return "has \0024\002" } if { [matchattr $hand |M $chan] } { return "has \0023\002" } if { [matchattr $hand |O $chan] } { return "has \0022\002" } if { [matchattr $hand |P $chan] } { return "has \0021\002" } return "lacks access" } proc saccess2 { hand chan } { if { [matchattr $hand |N $chan] } { return "\0025\002" } if { [matchattr $hand |C $chan] } { return "\0024\002" } if { [matchattr $hand |M $chan] } { return "\0023\002" } if { [matchattr $hand |O $chan] } { return "\0022\002" } if { [matchattr $hand |P $chan] } { return "\0021\002" } } proc noaccess {chan who} { putquick "NOTICE $who :You lack access in $chan to use this command." } proc nooverride {who} { putquick "NOTICE $who :You must have \002security override\002 on to use this command." } proc notice {who what} { putquick "NOTICE $who :$what" } proc cmdlog { chan nick hand what } { global channel staff putquick "NOTICE #penguinbot :($chan) \[$nick:$hand\] $what" } proc godmode { hand } { if { [matchattr $hand I] } { return 1 } else { return 0 } } proc cleanarg {arg} { set temp "" for {set i 0} {$i < [string length $arg]} {incr i} { set char [string index $arg $i] if {($char != "\12") && ($char != "\15")} { append temp $char } } set temp [string trimright $temp "\}"] set temp [string trimleft $temp "\{"] return $temp } proc pub_fix2 {n u h c a} { file mkdir data foreach chan [channels] { file mkdir data/$chan;set fp [open data/$chan/sets w+] puts $fp "greeting *" puts $fp "greeting2" close $fp } } proc auth_register {nick uhost hand arg} { global channel official global botnick admin if {$nick == $botnick} {return} if {[getting-users]} {notice $nick "Sorry, there is currently a userfile transfer going on. Try back in a couple of seconds." ; return} set account [lindex $arg 0] set pass [lindex $arg 1] set email [lindex $arg 2] if {$hand != "*"} { notice $nick "You Are already identified to account \002$hand\002." ; return } if {[validuser $account]} { notice $nick "That Account is already registered to somone else." ; return} if {$account == ""} { notice $nick "\002register\002 requires more parameters." ; notice $nick "/msg $botnick register \[email\]" ; notice $nick "Registers an account with \002$botnick\002 and adds your current hostmask. Each time you are seen by \002$botnick\002, you are automatically authed. You may do /msg $botnick auth only when your hostmask changes." ; return} if {$pass == ""} { notice $nick "Please Enter Password." ; return} if {$email == ""} { notice $nick "Please Enter a E-Mail Address." ; return} set host [join \*!\*[join [split $uhost "~"]] ""] adduser $account $host setpass $account $pass setuser $account XTRA "AUTH" "1" setuser $account XTRA "EMAIL" "$email" putcmdlog "$nick has registered the $account with the host of $host and the email address of: $email" putchan #penguinbot "$nick has registered the $account with the host of $host and the email address of: $email" notice $nick "Account \002$account\002 has been registered for you with the hostmask \002$host\002 and email address set to \002$email\002." notice $nick "If you have any problems, please contact the staff in #AvidBots" } proc auth_auth {nick uhost hand arg} { global channel staff global botnick set found 0 set account [lindex $arg 0] set pass [lindex $arg 1] if {$hand != "*"} { notice $nick "You Are already identified to account: \002$hand\002." ; return } if {![validuser $account]} { notice $nick "Your Account does not exist, are you sure you registered?." ; return} if {![passwdok $account $pass]} {notice $nick "Incorrect password; please try again." ; return} set host [join \*!\*[join [split $uhost "~"]] ""] setuser $account HOSTS $host notice $nick "I recognize you." if {[matchattr $account K] == 1} { putquick "notice $staff(channel) :$nick \[$uhost\] identified to SENIOR ADMINISTRATOR account $account." } if {[matchattr $account S] == 1} { putquick "notice $staff(channel) :$nick \[$uhost\] identified to ADMINISTRATOR account $account." } if {[matchattr $account X] == 1} { putquick "notice $staff(channel) :$nick \[$uhost\] identified to TECHINCAL SUPPORT account $account." } if {[matchattr $account Z] == 1} { putquick "notice $staff(channel) :$nick \[$uhost\] identified to SUPPORT account $account." } if {[matchattr $account B] == 1} { putquick "notice $staff(channel) :$nick \[$uhost\] identified to BETA STAFF account $account." } } proc pub_global {nick host hand chan text} { if {[godmode $hand] == 0} {nooverride $nick ; return} foreach chan [channels] { putquick "Privmsg $chan :\002|Announcement|\002$nick: $text" } } proc pub_aglobal {nick host hand chan text} { if {[godmode $hand] == 0} {nooverride $nick ; return} foreach chan [channels] { putquick "Privmsg $chan :\002|Announcement|\002Anonymous: $text" } } proc godmode { hand } { if { [matchattr $hand I] } { return 1 } else { return 0 } } proc notice {who what} { putquick "NOTICE $who :$what" } proc cmdlog { chan nick hand what } { global channel staff putquick "NOTICE $staff(channel) :($chan) \[$nick:$hand\] $what" } proc nooverride {who} { putquick "NOTICE $who :You must have security override on to use this command." } proc pub_god { nick host hand chan arg } { if { [matchattr $hand AHN] } { if { [matchattr $hand I] } { chattr $hand -I putquick "notice $nick :Security override has been \002disabled\002." glog $chan $nick $hand "god \002off\002" } else { chattr $hand +I putquick "notice $nick :Security override has been \002enabled\002." glog $chan $nick $hand "god \002on\002" } } else { putquick "notice $nick :God is a privileged command." } } proc pub_liststaff {nick host hand chan arg} { global botnick if { [set users1 [userlist K]] == "" } { set users1 "" } if { [set users2 [userlist S]] == "" } { set users2 "" } if { [set users3 [userlist X]] == "" } { set users3 "" } if { [set users4 [userlist Z]] == "" } { set users4 "" } if { [set users5 [userlist B]] == "" } { set users5 "" } putchan $chan "\002Senior Administrators\002: [join $users1] \002Administrators\002: [join $users2] \002Techincal Support\002: [join $users3] \002Support\002: [join $users4] \002Beta Staff\002: [join $users5]" } proc pub_die {nick uhost hand chan arg} { if {[matchattr $hand A] == 0} {noaccess2 $nick ; return} if {$arg == ""} { putnot $nick "\002die\002 requires more parameters." ; return} die "\002$nick\002 Issued DIE Command. (\002Reason:\002 $arg)" } proc pub_botrehash {nick host hand chan arg} { if {[matchattr $hand A] == 0} {noaccess2 $nick ; return} putquick "NOTICE $nick :Wrote database file on [ctime [unixtime]]" relog $chan $nick $hand "¡Bot Rehash Done!" rehash } proc pub_restart {nick host hand chan text} { if {[matchattr $hand A] == 0} {noaccess2 $nick ; return} global botnick putquick "NOTICE $nick :Restarting $botnick services." restart } proc glog { chan nick hand what } { global channel staff putchan #penguinbot "\002Command God\002: user $nick turned $what in $chan" } proc olog { chan nick hand what } { global channel staff putchan #penguinbot "$what" } proc noaccess2 {who} { putquick "NOTICE $who :You lack access to use this command." } proc relog { chan nick hand what } { global channel staff putchan #penguinbot "\002$nick\002: $what " } set cmdsfile "scripts/binds/cmds.ini" if {![file exists $cmdsfile]} { set fileid [open $cmdsfile w] close $fileid } { source $cmdsfile } set allcommands [list] foreach donecmd [split [read [set fileid [open $cmdsfile]]][close $fileid] \n][unset fileid] { if {[string match -nocase "bind pub - *" $donecmd]} { lappend allcommands [lindex [split $donecmd] 3] } } proc add:command {n u h c a} { global addedcommands set command [string tolower [lindex [split $a] 0]] set action [join [lrange [split $a] 1 end]] if {[info command added:$command] == ""} { set addedcommands($command) $action proc added:$command {n u h c a} { global addedcommands puthelp "privmsg $c :\001ACTION [string map [list %nick [lindex [split $a] 0]] $addedcommands($::lastbind)]\001" } bind pub - $command added:$command save:command $command $action puthelp "notice $n :Added add:$command command." } { puthelp "notice $n :Command added:$command already exists." } } proc count:command {n u h c a} { global allcommands if {[llength $allcommands]} { puthelp "privmsg $c :Available commands: [join $allcommands]" } { puthelp "privmsg $c :No commands available." } } proc del:command {n u h c a} { global allcommands set cmd [string tolower [lindex [split $a] 0]] if {![catch {unbind pub - $cmd added:$cmd}]} { if {[set i [lsearch -exact $allcommands $cmd]] != -1} { set allcommands [lreplace $allcommands $i $i] } puthelp "notice $n :Successfully remove \002$cmd\002 PUB command." } { puthelp "notice $n :Command \002$cmd\002 does not exist." } } proc save:command {c act} { global cmdsfile set c [string map {\[ \\\[ \] \\\] \\ \\\\} $c] set cmdlist [split [read [set f [open $cmdsfile]]] \n][close $f] lappend cmdlist "bind pub - $c added:$c" lappend cmdlist "" lappend cmdlist "set addedcommands($c) [list $act]" lappend cmdlist "" set f [open $cmdsfile w] foreach cmd $cmdlist { puts $f $cmd } puts $f [printproc added:$c] close $f } # user's proc from the Tcl faq forum proc printproc proc { set args {} foreach arg [info args $proc] { if {[info default $proc $arg val]} { lappend args [list $arg $val] } { lappend args [list $arg] } } list proc $proc $args [info body $proc] } proc oset { nick mask hand chan text } { if {[lindex $text 0] != ""} { set n [lindex $text 0] if {[lindex $text 1] == "support"} { chattr $n +hjlmotxZQCH putlog "$nick added $n to the bot." putchan #penguinbot "\002$n\002 has been set as a support memeber." } elseif {[lindex $text 1] == "betastaff"} { chattr $n +hjlmnotxBQC putlog "$nick added $n to the bot." putchan #penguinbot "\002$n\002 has been set as a beta memeber." } elseif {[lindex $text 1] == "tsupport"} { chattr $n +hjlmotxXQCNH putlog "$nick added $n to the bot." putchan #penguinbot "\002$n\002 has been set as a technical support memeber." } elseif {[lindex $text 1] == "admin"} { chattr $n +hjlmoptxSQCAHN putlog "$nick added $n to the bot." putchan #penguinbot "\002$n\002 has been set as an administrator" } elseif {[lindex $text 1] == "sadmin"} { chattr $n +hjlnoptxKQCAHN putlog "$nick added $n to the bot." putchan #penguinbot "\002$n\002 has been set as a senior administrator memeber." } elseif {[lindex $text 1] == "nobody"} { chattr $n -jlmnotxAGHIKNQXZBSC putlog "$nick deleted $n to the bot." putchan #penguinbot "!#PenguinBot deluser $n" putchan #penguinbot "!deluser $n" putchan #penguinbot "!kb $n You are no longer staff, there is no reason why you should need to be in here." putchan #penguinbot "\002$n\002 has been delete from this bot." } else { return } } } proc hire { nick mask hand chan text } { if {[lindex $text 0] != ""} { set n [lindex $text 0] if {[lindex $text 1] == "support"} { chattr $n +hjlmotxZQCH putlog "$nick added $n to the bot." putchan #penguinbot "!#PenguinBot addop $n" putchan #penguinbot "!addop $n" putchan #penguinbot "!#PenguinBot resync putquick "NOTICE $n :Please join #PenguinBot, thank you." putchan #penguinbot "\002$n\002 has been hired as a support memeber." } elseif {[lindex $text 1] == "betastaff"} { chattr $n +hjlmnotxBQC putlog "$nick added $n to the bot." putchan #penguinbot "!#PenguinBot addpeon $n" putchan #penguinbot "!#PenguinBot resync putchan #penguinbot "!addpeon $n" putchan #penguinbot "!#PenguinBot resync" putquick "NOTICE $n :Please join #PenguinBot, thank you." putchan #penguinbot "\002$n\002 has been hired as a beta memeber." } elseif {[lindex $text 1] == "tsupport"} { chattr $n +hjlmotxXQCNH putlog "$nick added $n to the bot." putchan #penguinbot "!#PenguinBot adduser $n 250" putchan #penguinbot "!adduser $n 250" putchan #penguinbot "!#PenguinBot resync" putquick "NOTICE $n :Please join #PenguinBot, thank you." putchan #penguinbot "\002$n\002 has been hired as a technical support memeber." } elseif {[lindex $text 1] == "admin"} { chattr $n +hjlmoptxSQCAHN putlog "$nick added $n to the bot." putchan #penguinbot "!#PenguinBot addmaster $n" putchan #penguinbot "!addmaster $n" putchan #penguinbot "!#PenguinBot resync" putquick "NOTICE $n :Please join #PenguinBot, thank you." putchan #penguinbot "\002$n\002 has been hired as an administrator" } elseif {[lindex $text 1] == "sadmin"} { chattr $n +hjlnoptxKQCAHN putlog "$nick added $n to the bot." putchan #penguinbot "!#PenguinBot addco $n" putchan #penguinbot "!addco $n" putchan #penguinbot "!#PenguinBot resync" putquick "NOTICE $n :Please join #PenguinBot, thank you." putchan #penguinbot "\002$n\002 has been hired as a senior administrator memeber." } else { return } } } proc pub_say {nick uhost hand chan arg} { global botnick if {[godmode $hand] == 0} {nooverride $nick ; return} if {$arg == ""} {putquick "NOTICE $nick :\002say\002 requires more parameters." ; return 0} putchan $chan "$arg" } proc partylogou {idx text} { global partychan party-just-quit set hand [idx2hand $idx] set party-just-quit $hand if {[llength $text] > 1} { puthelp "PRIVMSG #penguinbot :\002$hand\002 left the partyline \([lrange [split $text] 1 end]\)." } else { puthelp "PRIVMSG #penguinbot :\002$hand\002 left the partyline \(lost connection\)." } return $text } proc partylogi {hand idx} { global partychan foreach who [dcclist] { if {[lindex $who 1] == $hand} { puthelp "PRIVMSG #penguinbot :\002$hand\002 joined the partyline." } } } proc botlink {botname via} { global partychan foreach who [dcclist] { puthelp "PRIVMSG #penguinbot :\002$botname\002 linked to $via" } } proc botdisc {botname} { global partychan foreach who [dcclist] { puthelp "PRIVMSG #penguinbot :\002$botname\002 was disconnected from botnet" } } proc partylogo {hand idx} { global partychan party-just-quit if {[info exists party-just-quit] && ${party-just-quit} == $hand} {unset party-just-quit ; return 0} puthelp "PRIVMSG #penguinbot :\002$hand\002 left the partyline \lost connection\." }