# pubcom.tcl # ----- Configuration ----- # # set here the public command trigger set vPubTrigger ! # set here user flags to use the command(s) reset set vPubFlagHigh n # set here user flags required to use the command(s) ban, kick, op, deop set vPubFlagMed m|m # set here user flags required to use the command(s) voice, devoice set vPubFlagLow o|o # set here the ban time in minutes (0 means permanent) set vPubBanTime 2 # ********************************************** # # ***** Code - Do Not Edit Below This Line ***** # # ********************************************** # # ----- Initialise ----- # proc pPubTrigger {} { global vPubTrigger return $vPubTrigger } # ----- Binds ----- # bind PUB $vPubFlagMed [pPubTrigger]ban pPubBan bind PUB $vPubFlagMed [pPubTrigger]deop pPubDeop bind PUB $vPubFlagMed [pPubTrigger]kick pPubKick bind PUB $vPubFlagMed [pPubTrigger]op pPubOp bind PUB $vPubFlagLow [pPubTrigger]devoice pPubDevoice bind PUB $vPubFlagLow [pPubTrigger]voice pPubVoice bind PUB $vPubFlagHigh [pPubTrigger]reset pPubCountReset # ----- Bind Procs ----- # proc pPubBan {nick uhost hand chan text} { global vPubBanTime set text [string trim $text] if {[llength [split $text]] == 1} { if {[onchan $text $chan]} { if {[botisop $chan]} { set hostmask $text!*@[join [lindex [split [getchanhost $text] @] 1]] set bancount [pPubBanRead] incr bancount pPubBanWrite $bancount newchanban $chan $hostmask $nick "requested by $nick - ban number #$bancount" $vPubBanTime } } } return 0 } proc pPubDeop {nick uhost hand chan text} { set text [string trim $text] if {[llength [split $text]] == 1} { if {[onchan $text $chan]} { if {[botisop $chan]} { if {[isop $text $chan]} { pushmode $chan -o $text flushmode $chan } } } } return 0 } proc pPubDevoice {nick uhost hand chan text} { set text [string trim $text] if {[llength [split $text]] == 1} { if {[onchan $text $chan]} { if {[botisop $chan]} { if {[isvoice $text $chan]} { pushmode $chan -v $text flushmode $chan } } } } return 0 } proc pPubKick {nick uhost hand chan text} { set text [string trim $text] if {[llength [split $text]] == 1} { if {[onchan $text $chan]} { if {[botisop $chan]} { set kickcount [pPubKickRead] incr kickcount pPubKickWrite $kickcount putkick $chan $text "requested by $nick - kick number #$kickcount" } } } return 0 } proc pPubOp {nick uhost hand chan text} { set text [string trim $text] if {[llength [split $text]] == 1} { if {[onchan $text $chan]} { if {[botisop $chan]} { if {![isop $text $chan]} { pushmode $chan +o $text flushmode $chan } } } } return 0 } proc pPubCountReset {nick uhost hand chan text} { set text [string trim $text] if {[llength [split $text]] == 0} { set count 0 set id [open bcount.txt w] puts $id $count close $id set id [open kcount.txt w] puts $id $count close $id putserv "PRIVMSG $chan :kick and ban counts reset to 0" } return 0 } proc pPubVoice {nick uhost hand chan text} { set text [string trim $text] if {[llength [split $text]] == 1} { if {[onchan $text $chan]} { if {[botisop $chan]} { if {![isvoice $text $chan]} { pushmode $chan +v $text flushmode $chan } } } } return 0 } # ----- Defined Procs ----- # proc pPubBanRead {} { if {[file exists bcount.txt]} { set id [open bcount.txt r] gets $id bancount if {![string is integer -strict $bancount]} { set bancount 0 } close $id } else { set bancount 0 } return $bancount } proc pPubKickRead {} { if {[file exists kcount.txt]} { set id [open kcount.txt r] gets $id kickcount if {![string is integer -strict $kickcount]} { set kickcount 0 } close $id } else { set kickcount 0 } return $kickcount } proc pPubBanWrite {bancount} { set id [open bcount.txt w] puts $id $bancount close $id return 0 } proc pPubKickWrite {kickcount} { set id [open kcount.txt w] puts $id $kickcount close $id return 0 } # ----- Acknowledgement ----- # putlog "Pubcom.tcl Loaded" # eof