Part of the problem with your if statement, is the time that it takes to get to it and process it..You don't show how the script is started. If you want that message to go out at the same time every day, then use a timer
Code:
on me:*:join:#:{
  .timermass 23:6:50 0 86400 .msg $chan Time for Mass
}


That will start a timer called mass when you join the channel, then at 23:06:50 every day it will display that message (presuming you are on a IRC channel at that time)

Regarding the ON INVITE, try this
Code:
on *:invite:#:{
  if $nick != $me {
    .join $chan
  }
}