One problem that you have, is that when a person joins a channel, they join as a regular user, that is, to say, no one has voice, half-ops, or ops when they join.
Here's a suggestion, although it's not perfect
on @*:join:#:{
.timer 1 3 check.reg $chan $nick
}
alias check.reg {
if $2 isreg $1 {
.mode $1 +v $2
}
}
This will delay the voicing of the person that joined for 3 seconds, usually more than enough time for a person/bot/service/server to op or half-op the person that joined.
If you don't want that delay, then you could go with this
on @*:join:#: mode $chan +v $nick
on @*:op:#:{
if $opnick isvoice $chan {
.mode $chan -v $opnick
}
}
on @*:serverop:#:{
if $opnick isvoice $chan {
.mode $chan -v $opnick
}
}
on @*:help:#:{
if $hnick isvoice $chan {
.mode $chan -v $hnick
}
}
With that, the person will be voiced upon joining, then devoiced if they are granted ops or half-ops in the channel
Please note that, as far as access is concerned, there's nothing that someone who is voiced can do, that a half-op or op can't do.
Personally, I'd go with the first of the two codes if it really makes a difference. I wouldn't recommend lowering the timing of the delay below 3 seconds, as there may be system/internet/server lag that has tio be accounted for.