; ------------ SETUP START ------------
; channels to trigger at (separate multiple channels by comma)
alias -l next.chans { return #help,#support }
; after joins of regular users, msg/notice users with level "admin" after N seconds
; note that if other user joins in the meantime, the timer restarts, so you won't flood that much
alias -l next.infodelay { return 7 }
; method to inform admins (put either "msg" or "notice")
alias -l next.info { return notice }
; ------------- SETUP END -------------
on @admin:JOIN:$($next.chans): !
on @*:JOIN:$($next.chans): {
hadd -m $ht $chan $hget($ht,$chan) $nick
$+(.timer,$ht,$chr(1),$chan) 1 $iif(($next.infodelay isnum 0-),$v1,5) next.informadmins
}
on me:*:PART:$($next.chans): { next.wipe }
on admin:PART:$($next.chans): !
on !*:PART:$($next.chans): { hadd -m $ht $chan $remtok($hget($ht,$chan),$nick,0,32) }
on me:*:QUIT: { next.wipe }
on admin:QUIT: !
on !*:QUIT: { while ($hfind($ht,$nickreg($nick),1,r).data) hadd $ht $v1 $remtok($hget($ht,$v1),$nick,0,32) }
on *:KICK:$($next.chans): {
if ($knick == $me) { next.wipe }
elseif (!$ulist($ial($knick),admin)) { hadd -m $ht $chan $remtok($hget($ht,$chan),$knick,0,32) }
}
on *:DISCONNECT: { next.wipe }
on !admin:NICK: !
on !*:NICK: { while ($hfind($ht,$nickreg($nick),1,r).data) hadd $ht $v1 $reptok($hget($ht,$v1),$nick,$newnick,0,32) }
on @admin:TEXT:!next:$($next.chans): {
if ($hget($ht,$chan)) { mode $chan +v $gettok($v1,1,32) }
else { $next.info $nick Help queue of $chan is empty. }
}
on admin:TEXT:!next:$($next.chans): { $next.info $nick I'm not opped! }
on admin:TEXT:!queue:$($next.chans): {
if ($hget($ht,$chan)) { $next.info $nick $numtok($v1,32) in queue: $replace($v1,$chr(32),$+($chr(32),->,$chr(32))) }
else { $next.info $nick Help queue of $chan is empty. }
}
on admin:TEXT:!addadmin &:$($next.chans): {
var %m = $iif($ial($2),$v1,$2)
if ($ulist(%m,admin,1)) { $next.info $nick $2 is already an admin: $qt($v1) }
elseif (%m !isnum) {
.auser -a admin $mask(%m,1) (admin by: $nick on $date $time $+ )
$next.info $nick Added $2 to admins: $mask(%m,1)
}
}
on admin:TEXT:!removeadmin &:$($next.chans): {
var %m = $iif($ial($2),$v1,$2), %rem
if (!$ulist(%m,admin,1)) { $next.info $nick $2 is no admin. }
elseif (%m !isnum) {
while ($ulist(%m,admin,1)) { %rem = %rem $qt($v1) | .ruser admin $v1 }
$next.info $nick Removed $2 from admins: %rem
}
}
on *:VOICE:$($next.chans): {
hadd -m $ht $chan $remtok($hget($ht,$chan),$vnick,0,32)
$+(.timer,$ht,$chr(1),$chan) off
}
alias -l ht { return $+(helpqueue,$cid) }
alias -l nickreg { return $+(/(?<=^|\s)\Q,$replacexcs($1,\E,\E\\E\Q),\E(?=$|\s),/i) }
alias -l next.wipe { if ($hget($ht)) $iif($chan,hdel,hfree) $ht $chan }
alias -l next.informadmins {
var %n = 1, %c = $gettok($ctimer,-1,1), %here
while ($ulist(*,admin,%n)) {
if ($ialchan($v1,%c,1).nick) {
%here = $addtok(%here,$v1,44)
if ($numtok(%here,44) == 4) { $next.info $v1 $next.message(%c) | var %here }
}
inc %n
}
if (%here) { $next.info $v1 $next.message(%c) }
}
alias -l next.message {
var %t = $numtok($hget($ht,$1),32)
return There $iif((%t > 1),are %t users,is $iif((%t == 1),one user,no user left)) in the help queue of $1 $+ .
}