Code: Select all
-Bot- Sorry, but I can't adduser myself.
No, I need it for Undernet (X)speechles wrote:If your trying to do this on a network with services.....
http://forum.egghelp.org/viewtopic.php?t=13262&start=2
it's already been realized....
Code: Select all
namespace eval idle {
variable author "metroid"
variable version "1.0"
variable activechans [list #chan1 #chan2 #chan3];
# Idle time in minutes for ops. (set this to 0 to disable)
variable idletime 30
# Idle time in minutes for voiced users. (set this to 0 to disable)
variable idletime_v 10
# Nicknames that should always be excluded (the bot itself is always excluded)
variable exempt_nick [list somenick someother_nick]
# Botusers with these flags are also exempted
variable exempt_flag "f|f"
bind TIME -|- {* * * * *} [namespace current]::check
}
proc idle::check {args} {
foreach channel $idle::activechans {
if {!([validchan $channel] && [botonchan $channel] && [botisop $channel])} {
continue;
}
foreach user [chanlist $channel] {
if {[isbotnick $user]} {
continue;
}
if {[lsearch -exact $idle::exempt_nick $user]} {
continue;
}
set handle [nick2hand $user];
if {[validuser $handle] && [matchattr $handle $idle::exempt_flag $channel]} {
continue;
}
if {([isop $user $channel] && $idle::idletime && ([getchanidle $user $channel] > $idle::idletime))} {
pushmode $channel -o $user
} elseif {([isvoice $user $channel] && $idle::idletime_v && ([getchanidle $user $channel] > $idle::idletime_v))} {
pushmode $channel -v $user
}
}
flushmode $channel
}
}
putlog "Inactive op/voice remover loaded."
good job metroidmetroid wrote:I took the liberty to completely rewrite that script.
[untested]Code: Select all
namespace eval idle { variable author "metroid" variable version "1.0" variable activechans [list #chan1 #chan2 #chan3]; # Idle time in minutes for ops. (set this to 0 to disable) variable idletime 30 # Idle time in minutes for voiced users. (set this to 0 to disable) variable idletime_v 10 # Nicknames that should always be excluded (the bot itself is always excluded) variable exempt_nick [list somenick someother_nick] # Botusers with these flags are also exempted variable exempt_flag "f|f" bind TIME -|- {* * * * *} [namespace current]::check } proc idle::check {args} { foreach channel $idle::activechans { if {!([validchan $channel] && [botonchan $channel] && [botisop $channel])} { continue; } foreach user [chanlist $channel] { if {[isbotnick $user]} { continue; } if {[lsearch -exact $idle::exempt_nick $user]} { continue; } set handle [nick2hand $user]; if {[validuser $handle] && [matchattr $handle $idle::exempt_flag $channel]} { continue; } if {([isop $user $channel] && $idle::idletime && ([getchanidle $user $channel] > $idle::idletime))} { pushmode $channel -o $user } elseif {([isvoice $user $channel] && $idle::idletime_v && ([getchanidle $user $channel] > $idle::idletime_v))} { pushmode $channel -v $user } } flushmode $channel } } putlog "Inactive op/voice remover loaded."