Just incase someone decides to be a silly bugger and reapply the ban the second your script unsets it you also should have the /cs invite #Channel or /msg ChanServ invite #Channel commands available. That, along with /join #Channel will get you back in banned or not.

Remember that either way is just a backup measure. If you are being kicked for the fun of it then you might want to speak to your SOPs or Founder about it.