{"size": 893, "ext": "js", "max_stars_repo_path": "bot-modules/help.js", "max_stars_repo_name": "mittorn/kb-js", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "bot-modules/help.js", "max_issues_repo_name": "mittorn/kb-js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "bot-modules/help.js", "max_forks_repo_name": "mittorn/kb-js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.5142857143, "max_line_length": 96, "alphanum_fraction": 0.6069428891}
///// CONFIGURATION OF HELP MODULES

var helpModules = {};

var traceroute = require("./traceroute.js");
helpModules['traceroute'] = traceroute.getHelp;
var masta = require("./masta.js");
helpModules['маста'] = masta.getHelp;


exports.runQuery = function(client, query, querySender, queryRoom) {
  var params, line;

  console.log('Helped called for ' + query);

  if(query && (params = query.match(/([a-zA-Z0-9]+)( (.+))?/))) {
    if(helpModules[params[1]]) {
      line = helpModules[params[1]](params[3]);
    } else {
      line = 'Hello there! Unfortunately, the module "' + params[1] + '" does not yet exist...';
    }
  } else {
    line = '[ КОМАНДЫ ]\n\n';

    Object.keys(helpModules).forEach(function(k) {
      line += 'кб ' + k + '\n';
    });
    
    line += '\nХозяин бота - @mittorn:matrix.org';
  }

  console.log(line);
  client.sendBotNotice(queryRoom.roomId, line);
};
