通过hunter调用gm指令，可调用hunter指令库中定义的所有指令，也可以调用text类型的gm指令
        gm指令相关功能请参考safaia GM指令扩展模块

        :param cmd: 指令
        :param type: 语言，默认text
        :return: None
166791
def command(self, cmd, type=None):
        

        type = type or 'text'
        self.hunter.script(cmd, lang=type)
960523
def cmd(send, msg, args):
    

    parser = arguments.ArgParser(args['config'])
    parser.set_defaults(session=args['db'])
    subparser = parser.add_subparsers()
    start_parser = subparser.add_parser('start')
    start_parser.set_defaults(func=create_stopwatch)
    stop_parser = subparser.add_parser('stop')
    stop_parser.add_argument('id', type=int)
    stop_parser.set_defaults(func=stop_stopwatch)
    resume_parser = subparser.add_parser('resume')
    resume_parser.add_argument('id', type=int)
    resume_parser.set_defaults(func=resume_stopwatch)
    delete_parser = subparser.add_parser('delete')
    delete_parser.add_argument('id', type=int)
    delete_parser.set_defaults(func=delete_stopwatch, isadmin=args['is_admin'](args['nick']))
    get_parser = subparser.add_parser('get')
    get_parser.add_argument('id', type=int)
    get_parser.set_defaults(func=get_stopwatch)
    list_parser = subparser.add_parser('list')
    list_parser.set_defaults(func=list_stopwatch, nick=args['nick'], send=send)

    if not msg:
        send("Please specify a command.")
        return

    try:
        cmdargs = parser.parse_args(msg)
    except arguments.ArgumentException as e:
        send(str(e))
        return

    send(cmdargs.func(cmdargs))
554774
function parseEntityBotCommand(text, entity) {
    let result = RE_BOT_COMMAND.exec(text.substr(
        entity.offset,
        entity.length
    ));

    return {
        type: entity.type,
        name: result[1],
        mention: result[2],
    };
}
172371
public int commandToDocType(String strCommand)
    {
        if (ProjectTask.PROJECT_PREDECESSOR_DETAIL_SCREEN.equalsIgnoreCase(strCommand))
            return ProjectTask.PROJECT_PREDECESSOR_DETAIL_MODE;
        if (ProjectTask.PROJECT_TASK_CALENDAR_SCREEN.equalsIgnoreCase(strCommand))
            return ProjectTask.PROJECT_TASK_CALENDAR_MODE;
        return super.commandToDocType(strCommand);
    }
1026504
public int commandToDocType(String strCommand)
    {
        if (MessageInfo.PROCESS_DETAIL_SCREEN.equalsIgnoreCase(strCommand))
            return MessageInfo.PROCESS_DETAIL_MODE;
        return super.commandToDocType(strCommand);
    }
1264329
function cmd(method, params, callback, streamResults, returnRawData){

        var results = [];

        async.each(instances, function(instance, eachCallback){

            var itemFinished = function(error, result, data){

                var returnObj = {
                    error: error,
                    response: (result || {}).result,
                    instance: instance
                };
                if (returnRawData) returnObj.data = data;
                if (streamResults) callback(returnObj);
                else results.push(returnObj);
                eachCallback();
                itemFinished = function(){};
            };

            var requestJson = JSON.stringify({
                method: method,
                params: params,
                id: Date.now() + Math.floor(Math.random() * 10)
            });

            performHttpRequest(instance, requestJson, function(error, result, data){
                itemFinished(error, result, data);
            });


        }, function(){
            if (!streamResults){
                callback(results);
            }
        });

    }
742792
function (fnName, args) {
            var cmdName = args[0].toLowerCase(),
                cmd, cmdFn;
            cmd = this.commands[cmdName] || UE.commands[cmdName];
            cmdFn = cmd && cmd[fnName];
            //没有querycommandstate或者没有command的都默认返回0
            if ((!cmd || !cmdFn) && fnName == 'queryCommandState') {
                return 0;
            } else if (cmdFn) {
                return cmdFn.apply(this, args);
            }
        }
88320
def x10_command_type(command):
    """"""
    command_type = X10CommandType.DIRECT
    if command in [X10_COMMAND_ALL_UNITS_OFF,
                   X10_COMMAND_ALL_LIGHTS_ON,
                   X10_COMMAND_ALL_LIGHTS_OFF]:
        command_type = X10CommandType.BROADCAST
    return command_type
34045
public int commandToDocType(String strCommand)  // Standard file maint for this record (returns new record)
    {
        int iDocMode = ScreenConstants.MAINT_MODE;
        if ((MenuConstants.FORM.equalsIgnoreCase(strCommand))
            || (MenuConstants.FORMLINK.equalsIgnoreCase(strCommand)))
                iDocMode = ScreenConstants.MAINT_MODE;
        else if ((MenuConstants.LOOKUP.equalsIgnoreCase(strCommand))
            || (MenuConstants.LOOKUPCLONE.equalsIgnoreCase(strCommand)))
                iDocMode = ScreenConstants.DISPLAY_MODE;
        else if (MenuConstants.FORMDETAIL.equalsIgnoreCase(strCommand))
            iDocMode = ScreenConstants.DISPLAY_MODE | 64;
        else if (MenuConstants.POST.equalsIgnoreCase(strCommand))
            iDocMode = ScreenConstants.DISPLAY_MODE | 128;
        else if (MenuConstants.MENUREC.equalsIgnoreCase(strCommand))
            iDocMode = ScreenConstants.MENU_MODE;
        return iDocMode;
    }
1181055
def cmd(send, msg, args):
    
    match = re.match(r'--(.+?)\b', msg)
    randtype = 'hex'
    if match:
        if match.group(1) == 'int':
            randtype = 'int'
        else:
            send("Invalid Flag.")
            return
    if randtype == 'hex':
        send(hex(getrandbits(50)))
    else:
        maxlen = 1000000000
        msg = msg.split()
        if len(msg) == 2:
            if msg[1].isdigit():
                maxlen = int(msg[1])
            else:
                send("Invalid Length")
                return
        send(str(randrange(maxlen)))
503923
private DockerCommand createCommand(Class<? extends DockerCommand> commandType) {
        try {
            return commandType.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new BeanCreationException("Failed to create Docker command of type: " + commandType, e);
        }
    }
563621
function batchCmd(cmdArray, callback){

        var requestJson = [];

        for (var i = 0; i < cmdArray.length; i++){
            requestJson.push({
                method: cmdArray[i][0],
                params: cmdArray[i][1],
                id: Date.now() + Math.floor(Math.random() * 10) + i
            });
        }

        var serializedRequest = JSON.stringify(requestJson);

        performHttpRequest(instances[0], serializedRequest, function(error, result){
            callback(error, result);
        });

    }
500191
async def cmd_id(message: types.Message):
    
    if message.reply_to_message:
        target = message.reply_to_message.from_user
        chat = message.chat
    elif message.forward_from and message.chat.type == ChatType.PRIVATE:
        target = message.forward_from
        chat = message.forward_from or message.chat
    else:
        target = message.from_user
        chat = message.chat

    result_msg = [hbold('Info about user:'),
                  f"First name: {target.first_name}"]
    if target.last_name:
        result_msg.append(f"Last name: {target.last_name}")
    if target.username:
        result_msg.append(f"Username: {target.mention}")
    result_msg.append(f"User ID: {target.id}")

    result_msg.extend([hbold('Chat:'),
                       f"Type: {chat.type}",
                       f"Chat ID: {chat.id}"])
    if chat.type != ChatType.PRIVATE:
        result_msg.append(f"Title: {chat.title}")
    else:
        result_msg.append(f"Title: {chat.full_name}")
    return SendMessage(message.chat.id, '\n'.join(result_msg), reply_to_message_id=message.message_id,
                       parse_mode=ParseMode.HTML)
187444
function unknownCommand (ev) {
        var raw_cmd = ev.command + ' ' + ev.params.join(' ');
        this.app.connections.active_connection.gateway.raw(raw_cmd);
    }
1372089
function CommandArgLength(cmd) {
  this.name = CommandArgLength.name;
  if(arguments.length > 1) {
    cmd = slice.call(arguments, 0).join(' ');
  }
  StoreError.apply(
    this, [null, 'wrong number of arguments for \'%s\' command', cmd]);
}
1288847
def cmd(send, msg, args):
    
    if not msg:
        send("Seen who?")
        return
    cmdchar, ctrlchan = args['config']['core']['cmdchar'], args['config']['core']['ctrlchan']
    last = get_last(args['db'], cmdchar, ctrlchan, msg)
    if last is None:
        send("%s has never shown their face." % msg)
        return
    delta = datetime.now() - last.time
    # We only need second-level precision.
    delta -= delta % timedelta(seconds=1)
    output = "%s was last seen %s ago " % (msg, delta)
    if last.type == 'pubmsg' or last.type == 'privmsg':
        output += 'saying "%s"' % last.msg
    elif last.type == 'action':
        output += 'doing "%s"' % last.msg
    elif last.type == 'part':
        output += 'leaving and saying "%s"' % last.msg
    elif last.type == 'nick':
        output += 'nicking to %s' % last.msg
    elif last.type == 'quit':
        output += 'quiting and saying "%s"' % last.msg
    elif last.type == 'kick':
        output += 'kicking %s for "%s"' % last.msg.split(',')
    elif last.type == 'topic':
        output += 'changing topic to %s' % last.msg
    elif last.type in ['pubnotice', 'privnotice']:
        output += 'sending notice %s' % last.msg
    elif last.type == 'mode':
        output += 'setting mode %s' % last.msg
    else:
        raise Exception("Invalid type.")
    send(output)
953260
function (msg, type) {
    var cmd = type;
    
    switch (type) {
    case 'info':
        msg = '\x1B[33mINFO\x1B[0m: ' + msg;
        break;

    case 'debug':
        cmd  = 'info';
        msg = '\x1B[36mDEBUG\x1B[0m: ' + msg;
        break;

    case 'error':
    case 'fatal':
        cmd  = 'error';
        msg = '\x1B[31mERROR\x1B[0m: ' + msg;
        break;

    case 'ok':
        cmd  = 'info';
        msg = '\x1B[32mOK\x1B[0m: ' + msg;
        break;

    case 'bold':
        cmd  = 'info';
        msg = '\x1B[33mINFO\x1B[0m: \x1B[1m' + msg + '\x1B[0m';
        break;
    }
    
    console[cmd](msg); //Write output according to status severity
    if (type === 'fatal') {
        process.exit(1);
    }
}