Mode changes aren't server messages (raws), but is a remote event. Therefore, you can use:
On *:BAN:#: {
If ($Nick == $Me) { echo -a $Chan }
}
This is just an example, but you get the idea. $Nick = person who set the ban. $Chan = The channel the ban happened in.
If you really wanted to do it the /mode way, you could use:
alias mode {
If ($1) && (+b == $2) { set %Variable $1 }
mode $1-
}
To refer to the debug question, I've never dealt with them, so I can't help. Sorry.