; start offline timer to trigger "removeidlers"-alias every 30s
on *:start: .timerremoveidlers 0 30 removeidlers
on *:unload: .timerremoveidlers off
alias removeidlers {
; ######## SETUP START ########
; channels (separated by comma)
var %chans = #help,#anotherchannel
; max. idle duration (in seconds)
var %limit = 420
; kick delay (in milliseconds)
var %delay = 500
; ######## SETUP END ########
; create a clean temp file
var %f = removeidlers.txt
write -c $qt(%f)
; loop channels
var %c = 1
while ($gettok(%chans,%c,44)) {
; able to kick
if ($me isop $v1) {
; loop users of that chan
var %chan = $v2, %n = 1
while ($nick(%chan,%n,r)) {
var %nick = $v1
; if idle of that user exceeds idle limit: write kick command to temp file
if ($nick(%chan,$v1).idle > %limit) { write $qt(%f) kick %chan %nick Please don't idle in %chan }
inc %n
}
}
inc %c
}
; any lines in temp file
if ($lines(%f)) {
; play commands with specified delay to status window and remove tempfile
.play -pcs $qt(%f) %delay
.remove $qt(%f)
}
}