In my version of this feature I saved the second step of de-opping myself for quiets or bans (not followed by a kick) by adding a -o in the same line as the ban. For example, in aq:
set %command mode $chan +q-o $address($1,2) $me
Along with that change, the on RAWMODE will generate a "you are not operator" for cases where you were already de-op'd, so that can be fixed with a quick op check:
Code
So lines 157-159 will look like:
Code
..and you can optimize the foreach block's match and assignment by using a substituion in it's place:
Code