Are these commands you are sending or commands that your contact is sending to you?
Other option is to do something like this:
js code:
function OnEvent_ChatWndReceiveMessage(oChatWnd, sOrigin, sMessage, nMsgKind){
if (/^([\/|\!][^\s\/]+)\s*([\s\S]*)$/.exec(sMessage) !== null) {
if (RegExp.$1 === '!tfd' && RegExp.$2 === 'users') {
// put some code here
}
}
}