mTwitch icon indicating copy to clipboard operation
mTwitch copied to clipboard

ban/timeout reason and duration

Open SReject opened this issue 8 years ago • 2 comments

I need feedback on how this should be implemented, use cases, etc.

SReject avatar Jun 20 '16 17:06 SReject

This is what I have been using. Just my personal preference on the look.

on $*:PARSELINE:in:/^@msg-id=timeout_success :\S+ NOTICE #\S+ :\S+ has been timed out for \d+ seconds\.$/i: {
  .parseline -it
  haltdef
}

on $*:PARSELINE:in:/^(?:@ban-duration=(\d+);)?@?ban-reason=(\S+)? :\S+ CLEARCHAT (#\S+) :(\S+)$/iF: {
  var %dur $regml(1), %reason $replace($regml(2), $chr(92) $+ s, $chr(32)), %chan $regml(3), %nick $twitchname($regml(4),%chan)
  if (%reason && %dur) { echo $color(info text) %chan $+([,$asctime($ctime,h:nn TT),]) %nick has been timed out for %dur seconds. Reason: %reason }
  elseif (%reason && !%dur) { echo $color(info text) %chan $+([,$asctime($ctime,h:nn TT),]) %nick has been permanently banned. Reason: %reason }
  elseif (%dur && !%reason) { echo $color(info text) %chan $+([,$asctime($ctime,h:nn TT),]) %nick has been timed out for %dur seconds. }
  elseif (!%reason && !%dur) { echo $color(info text) %chan $+([,$asctime($ctime,h:nn TT),]) %nick has been permanently banned. }
  .parseline -it
  haltdef
}

Dissgruntled avatar Jun 22 '16 16:06 Dissgruntled

For implementation I'd prefer I use something IRC-RFC related. That way scripts can make use of built in events to handle such

SReject avatar Jun 22 '16 19:06 SReject