Hi, there. Let's see what help has to say about that:

1. The on DISCONNECT event ... and triggers when YOU quit or are disconnected from an IRC Server.

2. The on QUIT event triggers when a USER quits IRC while on the same CHANNEL as you.

So, from 1. and 2. => You can use $chan when using on quit, but not when using on disconnect.
Hope that helped a bit. cool