now i check it the problem , can't use non-numeric string as operand of "*"
only timed doesnt work, without timed ban works fine
Code: Select all
## >> irccloud_kb.tcl v0.1 << ##
################ Use the default kick reason: Requested ################
# !kb ted :kick & ban ted (this script doesn't remove this ban)
# !kb ted 20 :kick & ban ted (remove ban in 20 minutes)
# !kb ted 20m :kick & ban ted (remove ban in 20 minutes)
# !kb ted 90s :kick & ban ted (remove ban in 90 seconds)
# !kb ted 4h :kick & ban ted (remove ban in 4 hours)
# !kb ted 1d :kick & ban ted (remove ban in 24 hours)
################ Use a custom kick reason ################
# !kb ted Damn spammer :kick & ban ted (kick reason: Damn spammer)
# !kb ted 20 stop that :kick with reason: stop that (ban for 20 minutes)
################ Do just a kick, or just a ban ################
# !k ted :kick ted with default reason: Requested
# !k ted Damn spammer :kick ted with reason: Damn spammer
# !b ted :ban ted (this script doesn't remove this ban)
# !b ted 1h :ban ted (remove this ban in 1 hour)
bind pub o|o !kb pubm:kickban
bind pub o|o !k pubm:kick
bind pub o|o !b pubm:ban
proc pubm:kick {nick host hand chan text} {
pubm:kickban $nick $host $hand $chan $text k Kick
}
proc pubm:ban {nick host hand chan text} {
pubm:kickban $nick $host $hand $chan $text b Ban
}
proc pubm:kickban {nick host hand chan text {do kb} {say "Kick and Ban"} } {
set text [split [string trim $text]]
if {![llength $text]} {
puthelp "NOTICE $nick :Must provide a target nick to $say."
return 0
}
set text [lassign $text whom]
if {[isbotnick $whom] || ![botisop $chan] || [matchattr [nick2hand $whom $chan] mn]} {
return 0
}
if {[set chost [getchanhost $whom $chan]] eq ""} {
puthelp "NOTICE $nick :$whom is not on $chan"
return 0
}
append say " $whom"
if {[string match *b $do]} {
if {[string match "*.irccloud.com" $chost]} {
set mask *![lindex [split $chost @] 0]@*
} else { set mask [maskhost "$whom!$chost" 2] }
append say " ($mask"
if {[llength $text]} {
set rest [lassign $text exp]
if {[regexp {^([1-9][0-9]{0,3})([smhd]?)$} $exp - num dur]} {
if {$dur eq ""} { set dur m }
set tcall [list timed:unban $mask $chan $nick $num $dur]
if {$dur eq "d"} { timer [expr {$num * 1440}] $tcall
} elseif {$dur eq "h"} { timer [expr {$num * 60}] $tcall
} elseif {$dur eq "s"} { utimer $num $tcall
} else { utimer [expr {$num * 60}] $tcall }
append say " for $num$dur"
set text $rest
}
}
append say ")"
}
if {[string match k* $do]} { set reason "Requested"
if {[llength $text]} { set reason [join $text] }
append say " --> With Reason: $reason"
}
putquick "NOTICE $nick :$say"
if {[string match *b $do]} { putserv "MODE $chan +b $mask" }
if {[string match k* $do]} { putserv "KICK $chan $whom :$reason" }
}
proc timed:unban {mask chan nick num dur} {
if {[botisop $chan] && [ischanban $mask $chan]} {
putserv "MODE $chan -b $mask"
}
}
putlog "irccloud_kb.tcl v0.1 Loaded."