Code: Select all
# Channel
variable opchan "#Football"
# Idle time in minutes
variable idletime 60
bind time - "* * * *" deop_user
if {![info exists oplist]} { set oplist "" }
proc deop_user {a b c d e} {
global opchan idletime oplist
set users [lrange [chanlist $opchan] 1 end]
foreach user $users {
if {[getchanidle $user $opchan] >= $idletime && [isop $user $opchan] && ![isbotnick $user]} {
# Oprotate exemption: check if the user is a qualified op. If he/she is then check if without them there
# would be any qualified ops left. If not, then do not deop the user (requires oprotate.tcl to be loaded)
if {[namespace exists oprotate] && [channel get $opchan oprotate] && [oprotate::user_is_qualified_op $opchan $user] && [oprotate::find_best_qualified_op $opchan $user] == ""} {
# You can remove the line below (the putlog, not the return!) if this message is too spammy ;)
putlog "oprotate/deop: Not going to deop $user in $opchan because they are the only qualified op left."
return
}
pushmode $opchan "-o" $user
lappend oplist [getchanhost $user $opchan]
} elseif {[getchanidle $user $opchan] < $idletime && ![isop $user $opchan] && [lsearch -exact $oplist [getchanhost $user $opchan]] != -1} {
pushmode $opchan "+o" $user
}
}
}