SReject / mTwitch

Twitch normalizer for mIRC
21 stars 8 forks source link

ban/timeout reason and duration #13

Open SReject opened 8 years ago

SReject commented 8 years ago

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

Dissgruntled commented 8 years ago

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
}
SReject commented 8 years ago

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