To achieve this, you could look for a "special command character" / and if found, get the text until next whitespace/end of line, check this against your list of commands and if there is a match, do some special action
var msg = "/admin this is a message", command, i;
if (msg.charAt(0) === '/') { // special
    i = msg.indexOf(' ', 1);
    i===-1 ? i = msg.length : i; // end of line if no space
    command = msg.slice(1, i); // command (this case "admin")
    if (command === 'admin') {
        msg = msg.slice(i+1); // rest of message
        // .. etc
    } /* else if (command === foo) {
    } */ else {
        // warn about unknown command
    }
} else {
    // treat as normal message
}