If can added a simple command to add idle except names like .chanset #chan exceptIdle Name1 Name2 Name3
and to not deop or loop for the chanserv BOT and prefix channel ~ & owner sop
If someone help here to fix it thanks
Code: Select all
.chanset #test +idlemode
<Bot> Successfully set modes { +idlemode } on #test
Code: Select all
.chanset #test idletime 60
<Bot> Successfully set modes { idletime { 60 } } on #test.
<Bot> [01:59:12] #John# chanset #test idletime { 60 }
TEST
Code: Select all
<John> .chanset #test "Tommy Clay"
<Bot> Error trying to set "Tommy Clay" for #test, illegal channel option: "Tommy Clay"
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"
}
}
}
}
}