function truncCommandMessage(message) {
    const commandMatch = message.match(commandRegex);
    if (commandMatch) {
        return message.substring(0, commandMatch.index + commandMatch[0].length);
    }
    return message;
}
Javascript has a built in object for sets but not intervals.
Currently the interval (lowerbound,upperbound] is represented as an Array: `[lowerbound, upperbound, '(]']`