Your timer/alias did not work mainly due to the fact that $nick and $chan are only valid within the onJOIN event. Even though you started the timer inside the onJOIN event, when it actually fires 5 seconds later, those identifiers are no longer valid. In order to use those $nick and $chan in an alias when called by a timer, you need to either pass them as arguments to the alias, or save them in a variable. In this case, the easiest way is to pass them as arguments. Example:


on *:JOIN:#: { 
  .timer 1 5 MyJoin $nick $chan
alias MyJoin {
  ;; $1=nick, $2=chan

  echo -at Nick is $1
  echo -at Chan is $2

The $nick is passed as the first argument, and $chan is passed as the second argument, so inside the alias, you need to use $1 for nick, and $2 for chan. Using those two values, you should be able to create the rest of your script.