Advertisement
westor

Twitch flood protection for Ryntovy v1.3

Jul 11th, 2018
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.85 KB | None | 0 0
  1. ON *:TEXT:*:#: {
  2.   tokenize 32 $strip($1-)
  3.  
  4.   var %coms = !spam,!spaminfo,!spamstop
  5.   if ($istok(%coms,$1,44)) || ($mod) { goto commands }
  6.  
  7.   if ($evalnext($+(%,flood_,$chan,_reset))) { var %d = $evalnext($+(%,flood_,$chan,_reset)) }
  8.   inc $+(-eu,$iif(%d,$v1,10)) %flood_ $+ $chan $+ _ $+ $nick $+ _spam 1
  9.  
  10.   if ($evalnext($+(%,flood_,$chan,_times))) && ($evalnext($+(%,flood_,$chan,_seconds))) && ($evalnext($+(%,flood_,$chan,_,$nick,_spam)) > $evalnext($+(%,flood_,$chan,_times))) {
  11.     unset $+(%,flood_,$chan,_,$nick,_spam)
  12.     msg $chan .timeout $nick 1
  13.     return
  14.   }
  15.  
  16.   :commands
  17.   if ($1 == !spam) {
  18.     if (!$mod) { .msg $chan ( $+ $nick $+ ): Error, You have not access for that command, limited to moderators! | return }
  19.     if (!$2) { .msg $chan ( $+ $nick $+ ): Error, Please specify the messages times! | return }
  20.     if (!$3) { .msg $chan ( $+ $nick $+ ): Error, Please specify the messages seconds! | return }
  21.     if ($4) && ($isdigit($4)) { var %d = $4 }
  22.     if (!$isdigit($2)) { .msg $chan ( $+ $nick $+ ): Error, Please specify only digital numbers as messages times! | return }
  23.     if (!$isdigit($3)) { .msg $chan ( $+ $nick $+ ): Error, Please specify only digital numbers as messages seconds! | return }
  24.  
  25.     set %flood_ $+ $chan $+ _times $2
  26.     set %flood_ $+ $chan $+ _seconds $3
  27.     if (%d) { set %flood_ $+ $chan $+ _reset $4 }
  28.     elseif (!%d) { unset $+(%,flood_,$chan,_reset) }
  29.  
  30.     .msg $chan ( $+ $nick $+ ): The Flood Protection has been set as $2 messages in $3 seconds, resetting idle message set $iif(%d,$v1,10 as default) $+ .
  31.   }
  32.   if ($1 == !spaminfo) {
  33.     if (!$mod) { .msg $chan ( $+ $nick $+ ): Error, You have not access for that command, limited to moderators! | return }
  34.     var %t = $evalnext($+(%,flood_,$chan,_times))
  35.     var %m = $evalnext($+(%,flood_,$chan,_seconds))
  36.     var %r = $evalnext($+(%,flood_,$chan,_reset))
  37.     if (!%t) && (!%m) { .msg $chan ( $+ $nick $+ ): You have not set any Flood Protection settings yet! }
  38.     else { .msg $chan ( $+ $nick $+ ): Your channel Flood Protection settings are %t times per %m seconds with $iif(%r,$v1,10) seconds of idle reset time. }
  39.   }
  40.   if ($1 == !spamstop) {
  41.     if (!$mod) { .msg $chan ( $+ $nick $+ ): Error, You have not access for that command, limited to moderators! | return }
  42.     if (!$evalnext($+(%,flood_,$chan,_times))) && (!$evalnext($+(%,flood_,$chan,_seconds))) { .msg $chan ( $+ $nick $+ ): The Flood Protections doesn't actually running on this channel! }
  43.     else {
  44.       unset $+(%,flood_,$chan,_*)
  45.       .msg $chan ( $+ $nick $+ ): The Flood Protection has been stopped and resetted for that channel!
  46.     }
  47.   }
  48. }
  49.  
  50. alias -l mod { return $iif($msgtags(user-type).key == mod || $mid(#, 2-) == $nick, $true) }
  51. alias -l isdigit {
  52.   if (!$isid) { return }
  53.   if ($1 == $null) { return 0 }
  54.   if ($regex($1,^\d+$)) { return 1 }
  55.   else { return 0 }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement