var Gitter = require('node-gitter');
var fs = require('fs');
var config = fs.existsSync('../config/local.js') ? require('../config/local.js') : {};

/**
 * Create new instance of GitterBot
 * @param {String} key Your API key
 * @constructor
 */
function GitterBot(key) {
  this.setApiKey(key);
}

GitterBot.prototype = {
  /**
   * Set API key to GitterBot instance
   * @param {String} key New API key
   * @returns {GitterBot}
   */
  setApiKey: function (key) {
    this._apiKey = key || process.env['GITTER_API_KEY'];
    return this;
  },

  /**
   * Get current API key
   * @returns {String}
   */
  getApiKey: function () {
    return this._apiKey;
  }
};

module.exports = GitterBot;

@@ -34,262 +34,284 @@
 ');%0A
-var fs = require('fs');%0Avar config = fs.existsSync('../config/local.js') ? require('../config/local.js') : %7B%7D;%0A%0A/**%0A * Create new instance of GitterBot%0A * @param %7BString%7D key Your API key%0A * @constructor%0A */%0Afunction GitterBot(key) %7B%0A  this.setApiKey(key
+%0A/**%0A * Create new instance of GitterBot%0A * @param %7BString%7D config Configuration object with %60apiKey%60 and %60room%60 properties%0A * @constructor%0A */%0Afunction GitterBot(config) %7B%0A  config = config %7C%7C %7B%7D;%0A%0A  this.setApiKey(config.apiKey);%0A  this.setRoom(config.room);%0A  this.connect(
 );%0A%7D
@@ -672,16 +672,1150 @@
 apiKey;%0A
+  %7D,%0A%0A  /**%0A   * Set room to which bot will connect%0A   * @param %7BString%7D room Which room you want to listen%0A   * @returns %7BGitterBot%7D%0A   */%0A  setRoom: function (room) %7B%0A    this._room = room %7C%7C 'ghaiklor/uwcua-vii';%0A    return this;%0A  %7D,%0A%0A  /**%0A   * Get current room which bot is listen%0A   * @returns %7BString%7D%0A   */%0A  getRoom: function () %7B%0A    return this._room;%0A  %7D,%0A%0A  /**%0A   * Update gitter client%0A   * @returns %7BGitterBot%7D%0A   */%0A  connect: function () %7B%0A    this._gitter = new Gitter(this.getApiKey());%0A    return this;%0A  %7D,%0A%0A  /**%0A   * Start bot for listening messages%0A   * @returns %7BGitterBot%7D%0A   */%0A  start: function () %7B%0A    this._gitter.rooms.join(this.getRoom()).then(function (room) %7B%0A      var events = room.listen();%0A%0A      room.send(%22Hey, I've start listening this room%22);%0A      events.on('message', function (message) %7B%0A        if (/%5Ecalc /.test(message)) %7B%0A          // TODO: implement eval%0A          console.log(message);%0A        %7D%0A      %7D);%0A    %7D);%0A%0A    return this;%0A  %7D,%0A%0A  /**%0A   * Stop bot for listening messages%0A   * @returns %7BGitterBot%7D%0A   */%0A  stop: function () %7B%0A    // TODO: implement this%0A    return this;%0A
   %7D%0A%7D;%0A%0A

Add creating gitter client and listen message