Add event handler for chat messages