Hixxy's well work and would be the best id say. (havent checked but i trust him!), but it does seem complexe to understand for people who dont know what the raws are.
Here is a method, altering as little of your code as possable.
on *:join:#:{
if ($nick == $me) {
.timer 1 3 on.join.msg $chan
}
}
alias -l on.join.msg {
if ($nick($1,0) >= 2) /msg $1 hello
else { /msg $1 hi }
}
}
* code untested *
on join , it cheks if it u, then sets off a time to do the rest in ON.JOIN.MSG alias , since the timer wont have $chan i pass it using $1
By waiting 3 seconds u can be pretty sure the channel list of nicks is done with so u know how many people there are, 1 seconds likely long enough.
This could be compacted down to this but again its harder for people to understand
on me:*:join:#:{ .timer 1 3 msg $chan $!iif($nick( $chan , 0) >=2,hello,hi) }
* code untested *
the me: makes it go off only on you. the timer is the actual MSG with a inline conditional for hi or hello the timer command would end up looking like this
MSG #channel $iif($nick( #channel ,0) >=2,hello,hi)
the $iif means if theres 2 or more it uses hello else use hi aka $iif(<condition>,<true>,<false>) returns with <true> or <false>