nbot

A clone of the eBot by @deStrO fully based on node.js with build in Web Page - WIP
git clone git://archive.git.mtrnord.blog/MTRNord/nbot.git
Log | Files | Refs | README | LICENSE

pluginManager.js (1183B)


      1 /**
      2 * Build and setup csgoserver
      3 *
      4 * @module nBot
      5 * @submodule pluginManager
      6 * @requires server, github
      7 */
      8 var GitHubApi = require("github");
      9 
     10 var github = new GitHubApi({
     11     // optional
     12     debug: false,
     13     protocol: "https",
     14     host: "api.github.com", // should be api.github.com for GitHub
     15     pathPrefix: "", // for some GHEs; none for GitHub
     16     headers: {
     17         "user-agent": "MTRNord" // GitHub is happy with a unique user agent
     18     },
     19     followRedirects: false, // default: true; there's currently an issue with non-get redirects, so allow ability to disable follow-redirects
     20     timeout: 5000
     21 });
     22 /**
     23 * @class pluginManager
     24 * @static
     25 */
     26 /**
     27 * @method getSourcemodVersions
     28 * @beta Work in Progress
     29 */
     30 var pluginManager = module.exports = {}
     31 pluginManager.getSourcemodVersions = function (socket, command) {
     32   github.repos.getTags({
     33     user: "alliedmodders",
     34     repo: "sourcemod"
     35   }, function(err, res) {
     36     if (err) {
     37       socket.emit('SourcemodList', {response: err, command: command.command})
     38       console.error(err)
     39     }else {
     40       socket.emit('SourcemodList', {response: res, command: command.command})
     41       //console.log(JSON.stringify(res))
     42     }
     43   })
     44 }