Listen on 'online' event instead of on 'message' event

Listening on the `online` event does the same thing as listening on the 'message' event and checking if the message is 'online'. This change does the exact same this as the current code, only in a shorter and clearer way.