Helper function - processing chat commands - chat.js