This is an idle TCL, how to make it works into all channel automatically. When I command +idle the idle detection will set ON in channel, then -idle the idle will be set OFF.
Code: Select all
## idle DetecteD ##
set timetocheckaway 10
set chanaway "#allchannels"
set idtimer 10
#######TEST#######
if {![info exists {ald}]} {
global botnick chanaway timetocheckaway
set ald 1
timer ${timetocheckaway} printing
}
proc printing {} {
global botnick chanaway timetocheckaway idtimer
putlog "Check away on $chanaway"
if {[botonchan $chanaway] == 1} {
if {[botisop $chanaway]==1} {
foreach user [chanlist $chanaway] {
if {[isbotnick $user] == 0} {
if {[isop $user $chanaway]==0} {
if {[isvoice $user $chanaway] == 1} {
set cekidle [getchanidle $user $chanaway]
if {$cekidle > $idtimer} {
set dodoldah "IdLe.DeteCteD"
pushmode $chanaway -k $dodoldah
pushmode $chanaway -v $user
}
putserv "WHOIS $user $user"
#putlog "testing idle"
}
}
}
}
}
}
timer ${timetocheckaway} printing
}
bind raw - 301 check_away
proc check_away { from keyword arg } {
global chanaway
set awaytext [string range [lrange $arg 2 end] 1 end]
set nickaway [lindex $arg 1]
if {[botonchan $chanaway] == 1} {
if { $awaytext != "" } {
if {[onchan $nickaway $chanaway] == 1} {
if {[matchattr $nickaway f] != 1} {
if {[isvoice $nickaway $chanaway] == 1} {
pushmode $chanaway -v $nickaway
#putlog "tesing idle"
#if {[string match *k* [lindex [split [getchanmode $chanaway]] 0]]} {
set dodoldah "IdLe.DeteCteD"
pushmode $chanaway -k $dodoldah
# }
}
}
}
}
}
}
## idle DetecteD ##
set timetocheckaway 5
set chanaway "#allchannels"
set idtimer 5
#######JANGAN EDIT DI BAWAH INI LINES#######
if {![info exists {ald}]} {
global botnick chanaway timetocheckaway
set ald 1
timer ${timetocheckaway} printing
}
proc printing {} {
global botnick chanaway timetocheckaway idtimer
putlog "Check away on $chanaway"
if {[botonchan $chanaway] == 1} {
if {[botisop $chanaway]==1} {
foreach user [chanlist $chanaway] {
if {[isbotnick $user] == 0} {
if {[isop $user $chanaway]==0} {
if {[isvoice $user $chanaway] == 1} {
set cekidle [getchanidle $user $chanaway]
if {$cekidle > $idtimer} {
set dodoldah "IdLe.DeteCteD"
pushmode $chanaway -k $dodoldah
pushmode $chanaway -v $user
}
putserv "WHOIS $user $user"
#putlog "testing idle"
}
}
}
}
}
}
timer ${timetocheckaway} printing
}
bind raw - 301 check_away
proc check_away { from keyword arg } {
global chanaway
set awaytext [string range [lrange $arg 2 end] 1 end]
set nickaway [lindex $arg 1]
if {[botonchan $chanaway] == 1} {
if { $awaytext != "" } {
if {[onchan $nickaway $chanaway] == 1} {
if {[matchattr $nickaway f] != 1} {
if {[isvoice $nickaway $chanaway] == 1} {
pushmode $chanaway -v $nickaway
#putlog "testing idle $nickaway is away and devoice on $chanaway"
#if {[string match *k* [lindex [split [getchanmode $chanaway]] 0]]} {
set dodoldah "IdLe.DeteCteD"
pushmode $chanaway -k $dodoldah
}
}
}
}
}
}
thx for help