westor

Bad Channels Protection for Kendy v3.1

Nov 29th, 2020 (edited)
591
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; ----------- Settings --------------
  2.  
  3. alias -l chans { return # } ; The channel(s) that code to work
  4. alias -l bad_file { return badchans.txt } ; The bad channels location file
  5. alias -l ban_kick { return 1 } ; 1 = kick him yes, 0 = no kick just ban
  6. alias -l ban_time { return 300 } ; 0 = permanent, (use seconds only)
  7. alias -l ban_type { return 2 } ; use /help $mask for ban type
  8. alias -l auto_recheck_secs { return 900 } ; seconds for automatically rescan (whois) all nicknames, use 0 to disable it
  9.  
  10. ; ----------- Settings --------------
  11.  
  12. ON *:JOIN:$($chans): {
  13.   if ($nick == $me) { .timer[CHECK_ $+ $chan $+ _BADCHANS] 0 $auto_recheck_secs recheck_all_badchans $chan | return }
  14.  
  15.   if ($me isreg $chan) { return }
  16.  
  17.   hadd -mu10 BCS $nick 1
  18.  
  19.   whois $nick
  20. }
  21.  
  22. RAW *:*: {
  23.   if (!$hget(BCS,0).item) || ($status !== connected) { return }
  24.  
  25.   haltdef
  26.  
  27.   var %h = $hget(BCS,$2)
  28.  
  29.   if ($numeric == 318) && (%h) { hdel BCS $2 }
  30.  
  31.   if ($numeric == 319) && (%h) {
  32.     var %r = $check_badchans($3-)
  33.     var %t = $comchan($2,0)
  34.  
  35.     if (!%r) || (!%t) { return }
  36.  
  37.     var %i = 1
  38.     while (%i <= %t) {
  39.       var %c = $comchan($2,%i)
  40.  
  41.       if ($me ison %c) && ($me isop %c) && ($2 ison %c) {
  42.         inc %knum 1
  43.  
  44.         var %f = -
  45.  
  46.         if ($ban_kick) { var %f = %f $+ k }
  47.         if ($ban_time) { var %f = %f $+ u $+ $ban_time }
  48.  
  49.         ban %f %c $2 $ban_type 4[Banned] (reason: You have been found in ( $+ $numtok(%r,32) $+ ) blacklisted channels ( $+ %r $+ ) -- for more infomation reagarding your ban please contact Kendy for removal -52- [Kick id: $chr(35) $+ %knum $+ ] (Expires in: $duration($ban_time) $+ )
  50.       }
  51.  
  52.       inc %i
  53.     }
  54.  
  55.   }
  56. }
  57.  
  58. alias recheck_all_badchans {
  59.   if (!$1) || ($me !ison $1) || ($me !isop $1) || ($status !== connected) { return }
  60.  
  61.   var %t = $nick($1,0,r)
  62.  
  63.   if (!%t) { return }
  64.  
  65.   var %i = 1
  66.   while (%i <= %t) {
  67.     var %n = $nick($1,%i,r)
  68.  
  69.     if (%n) { .timer[SCAN_ $+ %n $+ _BADCHANS] 1 $calc(%i * 5) recheck_badchan %n }
  70.  
  71.     inc %i
  72.   }
  73. }
  74.  
  75. alias recheck_badchan {
  76.   if (!$1) || ($status !== connected) { return }
  77.  
  78.   hadd -mu10 BCS $1 1
  79.  
  80.   whois $1
  81. }
  82.  
  83. alias -l check_badchans {
  84.   ; $check_badchans(chans)
  85.  
  86.   if (!$1) { return 0 }
  87.  
  88.   var %t = $numtok($1-,32)
  89.   var %i = 1
  90.  
  91.   while (%i <= %t) {
  92.     var %c = $remove($gettok($1-,%i,32),~,&,@,%,+)
  93.     var %r = $read($bad_file,nw,%c)
  94.  
  95.     if (%c) && (%r) { var %tot = $addtok(%tot,%c,32) }
  96.  
  97.     inc %i
  98.   }
  99.  
  100.   return $iif(%tot,$v1,0)
  101. }
  102.  
RAW Paste Data