Is there a need for the part
&& ($nick != ChanServ)
since you can\'t kick chanserv anyway?
I\'d like to see
on @*:kick:
I think the snippet can be condensed so that the raw commands are executed after the kick.... because if you have auto join on, you would come through the revolving door and execute the function... so you don\'t need all the part if opnick == $me etc... A timer might be useful so that if rejoin and ops are not gained in a certain period you get a notice that revenge time has expired for example... just an idea there. Anyhow, you have the line to join chan, and you have a method to gain ops, so... why not just execute the revenge without worry about the on op line?
Kick wars can be fun then get boring (as long as the channel is made for that type of thing) and then, like all wars, they escalate in power to become bans and blacklists etc.... Not a bad job.