You can make your on JOIN:
on !^*:JOIN:#: {
The "!" will make sure it doesn't activate when you join. If you do that, you won't need to check if the nick = $me