Advertisement
westor

Autoclear channel bans after X seconds for niemand v1.1

May 24th, 2023 (edited)
2,314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.79 KB | None | 0 0
  1. alias -l channels { return #one,#two,#three } ; Enter channels here (multi-channels allowed)
  2. alias -l check_delay { return 600 } ; Enter here how often you want the code to check to remove the bans, 600 is 10 mins in seconds, place seconds only here
  3. alias -l unban_delay { return 600 } ; Enter here the seconds you want to check and remove the bans (example 600 will remove all bans that have been set from 10 mins and more)
  4.  
  5. ON ME:*:JOIN:$($channels): {
  6.   set -eu10 %raw_ [ $+ [ $chan ] $+ ] _bans 1
  7.  
  8.   mode $chan b
  9.  
  10.   .timer[CLEARBANS_ $+ $chan $+ _AUTO] 0 $check_delay clearbans $chan
  11. }
  12.  
  13. raw 367:*: {
  14.   if (%raw_ [ $+ [ $2 ] $+ ] _bans) { haltdef }
  15. }
  16.  
  17. raw 368:*: {
  18.   if (%raw_ [ $+ [ $2 ] $+ ] _bans) { unset %raw_ $+ $2 $+ _bans | haltdef }
  19. }
  20.  
  21. alias clearbans {
  22.   ; /clearbans <#channel>
  23.  
  24.   if (!$1) { echo 4 -ste * /clearbans: Error, not enough parameters! | return }
  25.   if ($status !== connected) { echo 4 -ste * /clearbans: Error, You are not connected to a server! | return }
  26.   if ($left($1,1) !== $chr(35)) { echo 4 -ste * /clearbans: Error, enter a valid channel! | return }
  27.   if ($me !ison $1) { echo 4 -ste * /clearbans: Error, you are not on $1 channel! | return }
  28.   if ($me !isop $1) { echo 4 -ste * /clearbans: Error, you must have @ on $1 channel! | return }
  29.  
  30.   var %t = $ibl($1,0)
  31.  
  32.   if (!%t) { echo 4 -ste * /clearbans: Not any bans set on $1 channel! | return }
  33.  
  34.   var %i = 1
  35.   while (%i <= %t) {
  36.     var %b = $ibl($1,%i)
  37.     var %s = $ibl($1,%i).ctime
  38.  
  39.     if (%b) && (%s) && ($ctime > $calc(%s + $unban_delay)) { var %a = $calc(%a + 1) | mode $1 -b %b }
  40.  
  41.     inc %i
  42.   }
  43.  
  44.   if (%a) { echo -ste * /clearbans: Automatically removed %a ban(s) from $1 channel. }
  45.   else { echo -ste * /clearbans: There are bans set on $1 channel but not yet to remove any of them. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement