He has tcl 8.4 and lsearch does not have a -nocase option. The segment below makes it tcl 8.4 friendly. Change:caesar wrote:@Amr : What version of TCL do you have? Do a .status from your bot and it will be mentioned there if you don't know where to look.
Code: Select all
set excempt [channel get $chan idleExempt]
set time [channel get $chan idleTime]
foreach user $users {
if {[lsearch -nocase $excempt $user] != -1} continue
Code: Select all
set excempt [string tolower [channel get $chan idleExempt]]
set time [channel get $chan idleTime]
foreach user $users {
if {[lsearch -exact $excempt [string tolower $user]] != -1} continue
Code: Select all
set pos [lsearch -nocase $checkList $user:1]
if {$pos == -1} {
lappend checkList $user:2
Code: Select all
set pos [lsearch -exact [string tolower $checkList] [string tolower $user:1]]
Code: Select all
set users [lrange [chanlist $chan] 1 end]
set excempt [channel get $chan idleExempt]
set time [channel get $chan idleTime]
foreach user $users {
if {[lsearch -nocase $excempt $user] != -1} continue
Code: Select all
set users [string tolower [lrange [chanlist $chan] 1 end]]
set excempt [string tolower [channel get $chan idleExempt]]
set time [channel get $chan idleTime]
foreach user $users {
if {[lsearch -exact $excempt $user] != -1} continue
Code: Select all
set pos [lsearch -nocase $checkList $user:1]
Code: Select all
set pos [lsearch -exact $checkList $user:1]
Code: Select all
namespace eval idlemode {
setudef flag idleMode
setudef str idleExempt
setudef int idleTime
bind time - {10*} [namespace current]::idleTime
proc idleTime {args} {
foreach chan [channels] {
if {![channel get $chan idleMode]} continue
cronCheck $chan
}
}
proc cronCheck {chan} {
variable idle
switch -- [catch {botisop $chan} err] {
"0" {
if {!$err} {
putlog "idleMode error: I'm not oped in $chan channel."
return
}
}
"1" {
putlog "idleMode error: $chan channel is not valid."
return
}
}
set users [string tolower [lrange [chanlist $chan] 1 end]]
set excempt [string tolower [channel get $chan idleExempt]]
set time [channel get $chan idleTime]
foreach user $users {
if {[lsearch -exact $excempt $user] != -1} continue
if {[isop $user $chan]} {
lappend checkList $user:1
}
if {[isvoice $user $chan]} {
if {[info exists checkList]} {
set pos [lsearch -exact $checkList $user:1]
if {$pos == -1} {
lappend checkList $user:2
} else {
set checkList [lreplace $checkList $pos $pos $user:3]
}
} else {
lappend checkList $user:2
}
}
}
foreach ele [split $checkList] {
scan $ele {%[^:]:%s} user count
checkIdle $count $user $chan $time
}
}
proc checkIdle {mode user chan time} {
set idle [getchanidle $user $chan]
if {$idle >= $time} {
switch -- $mode {
"1" {
pushmode $chan -o $user
putlog "idleMode: deoped $user in $chan cos was idle for $idle minutes"
}
"2" {
pushmode $chan -v $user
putlog "idleMode: devoiced $user in $chan cos was idle for $idle minutes"
}
"3" {
puthelp "MODE $chan -ov $user $user"
putlog "idleMode: deoped and devoiced $user in $chan cos was idle for $idle minutes"
}
}
}
}
}
putlog "idlemode.tcl loaded..."
Code: Select all
bind time - {*/10 * * * *} [namespace current]::idleTime
Code: Select all
bind time - {?0*} [namespace current]::idleTime
Code: Select all
bind time - {*/10 * * * *} [namespace current]::idleTime
Code: Select all
namespace eval idlemode {
setudef flag idleMode
setudef str idleExempt
setudef int idleTime
bind time {?0 *} [namespace current]::idleTime
proc idleTime {args} {
foreach chan [channels] {
if {![channel get $chan idleMode]} continue
timedCheck $chan
}
}
proc timedCheck {chan} {
variable idle
switch -- [catch {botisop $chan} err] {
"0" {
if {!$err} {
putlog "idleMode error: I'm not oped in $chan channel."
return
}
}
"1" {
putlog "idleMode error: $chan channel is not valid."
return
}
}
set users [string tolower [lrange [chanlist $chan] 1 end]]
set except [string tolower [channel get $chan idleExempt]]
set time [channel get $chan idleTime]
foreach user $users {
if {[lsearch -exact $except $user] != -1} continue
if {[isop $user $chan]} {
lappend checkList $user:1
}
if {[isvoice $user $chan]} {
if {[info exists checkList]} {
set pos [lsearch -exact $checkList $user:1]
if {$pos == -1} {
lappend checkList $user:2
} else {
set checkList [lreplace $checkList $pos $pos $user:3]
}
} else {
lappend checkList $user:2
}
}
}
if {[info exists checkList]} {
foreach ele [split $checkList] {
scan $ele {%[^:]:%s} user count
checkIdle $count $user $chan $time
}
}
}
proc checkIdle {mode user chan time} {
set idle [getchanidle $user $chan]
if {$idle >= $time} {
switch -- $mode {
"1" {
pushmode $chan -o $user
putlog "idleMode: deoped $user in $chan cos was idle for $idle minutes"
}
"2" {
pushmode $chan -v $user
putlog "idleMode: devoiced $user in $chan cos was idle for $idle minutes"
}
"3" {
puthelp "MODE $chan -ov $user $user"
putlog "idleMode: deoped and devoiced $user in $chan cos was idle for $idle minutes"
}
}
}
}
}
putlog "idlemode.tcl loaded..."