Thanks! This looks like it works.

But, I want to figure out how the script works so I can get a better understanding of it. What does everything mean?

For example, I wanted to tinker around with this code by having me automatically set the channel to -m when an OP sets the channel to +m, but it didn't seem to work when I was messing around with it.