Jump to content
coders-irc_Bot

Auto-Rejoin on Ban or Block

Recommended Posts

  • Administrators

Automatically rejoin channels you have been banned or blocked from joining.

Great for making sure your unattended client stays in all its channels, weathering through netsplits and takeovers or the occasional kick-ban.

 

; r_autorejoin.mrc * Version 2.2 * 21-Nov-2012 * Raccoon/EFnet
; This script has no dependencies. It belongs in the Remotes section.

;*******************************************************************************
;* Automatically rejoin channels you have been banned or blocked from joining. *
;* The script will keep retrying until you close the channel or get back in.   *
;* First 12 tries at +10,+20... seconds, and then between 10-30 minutes random.*
;* Requires 'Rejoin channel when kicked' and 'Keep channels open' are enabled. *
;* Also some extras: Rejoin on Invite, and Rejoin on Freenode's /quote remove  *
;* Written by Raccoon on 21-Nov-2012. #mIRC/EFNet #mSL/SwiftIRC www.hawkee.com *
;*******************************************************************************

;----- Begin "Auto-Rejoin When Blocked" by Raccoon -----
RAW 474:*: fail_join $2 until ban is lifted...
RAW 471:*: fail_join $2 until limit is increased...
RAW 473:*: fail_join $2 until invite-only is removed...
RAW 475:*: fail_join $2 until key is removed...
RAW 477:*: fail_join $2 until auth-only is removed...
RAW 480:*Cannot join channel*: fail_join $2 until SSL-only is removed...
RAW 489:*Cannot join channel*: fail_join $2 until SSL-only is removed...
RAW 437:*temporarily unavailable*: fail_join $2 until channel becomes available...

ALIAS -l fail_join { ; By Raccoon 21-Nov-2012
  if ($1 ischan) {
    inc -eu1830 %FAILJOIN. $+ $cid $+ $1
    var %n = $($+(%,FAILJOIN.,$cid,$1),2)
    var %t = $iif(%n isnum 1-12,$calc(%n * 10),$r(600,1800))
    .timerFAILJOIN. $+ $cid $+ $1 1 %t _timer_rejoin $chsafe($1)
    var %str = Attempting to rejoin $2-
    if (%n == 1) { .timer 1 0 echo -tic notice $chsafe($1) * %str }
    else { haltdef }
} }

ALIAS -l _timer_rejoin { ; By Raccoon 21-Nov-2012
  if ($1 ischan) && ($me !ison $1) { !join $1 $chan($1).key }
  else { unset %FAILJOIN. $+ $cid $+ $1 }
}

;366 $me $chan :End of /NAMES list.
RAW 366:*: { unset %FAILJOIN. $+ $cid $+ $2 }

;Use in /timers to sanitize channel names like #$($p(hacked!)). By Raccoon.
ALIAS -l chsafe { return $iif($ isin $1,$!replace( $replace($1,$,`$) ,`$,$),$1) }

;*** EXTRAS ***

;Auto-rejoin open channel when Invited. Useful for mistake kick-bans.
On *:INVITE:#: if ($chan ischan) { !join $chan $chan($chan).key }

;Auto-rejoin on forced part via '/quote remove $chan $nick' command on Freenode.
On me:*:PART:#: { ; By Raccoon 18-Nov-2012
  if $regex($1-,/requested by (\S+) \(\S+\)/) {
    var %r = $r(10,30)
    echo -stic notice * Forcibly Parted from $chan by $regml(1) $+ . Rejoining in %r seconds...
    .timer 1 %r !join -n $chsafe($chan)
} }
;----- End "Auto-Rejoin When Blocked" by Raccoon -----

;v1.0 27-Aug-2012 - Auto Rejoin when Banned, initial script.
;v1.1 12-Sept-2012 - Added $chsafe() to sanitize potential exploits.
;v2.0 18-Nov-2012 - Rewritten to support all blocks; +b/+l/+i/+k/netsplit.
;v2.1 18-Nov-2012 - Added support for other channel join blocks (auth/ssl/etc).
;                   Also threw in some extras: Rejoin on Invite, and on /remove.
;v2.2 21-Nov-2012 - Fixed: Instance of %chan should be $1 in timer's name.
;TODO: Attempt retrying channels that haven't been joined yet (no channel window).
;      This will require some custom @window listing channels in queue to rejoin.

;http://www.hawkee.com/snippet/9729/
;http://kthx.net/paste/abpw70srhzc40808ko

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...