code: function Bot(credentials, globalObject, initializationCompleteCallback) {
      LOG.info("Attempting to log in with email {}", credentials.username);
  
      new DubAPI(credentials, (function(err, _bot) {
          if (err) {
              throw new Error("Error occurred when logging in: " + err);
          }
  
          this.bot = _bot;
  
          LOG.info("Logged in successfully");
  
          // Set up an error handler so errors don't cause the bot to crash
          this.bot.on('error', function(err) {
              LOG.error("Unhandled error occurred; swallowing it so bot keeps running. Error: {}", err);
          });
  
          // Reconnect the bot automatically if it disconnects
          this.bot.on('disconnected', (function(roomName) {
              LOG.warn("Disconnected from room {}. Reconnecting..", roomName);
              this.connect(roomName);
          }).bind(this));
  
          // Set up custom event handling to insulate us from changes in the dubtrack API
          this.eventHandlers = {};
          for (var eventKey in Types.Event) {
              var eventName = Types.Event[eventKey];
              this.eventHandlers[eventName] = [];
          }
  
          if (globalObject.config.DubBotBase.logAllEvents) {
              LOG.info("Logging of all events is enabled. Setting up logging event handlers.");
              for (var eventKey in Types.Event) {
                  var eventName = Types.Event[eventKey];
                  LOG.info("Hooking into eventKey {}, eventName {}", eventKey, eventName);
                  this.bot.on(eventName, (function(name) {
                      return function(event) {
                          LOG.info("event '{}' has JSON payload: {}", name, event);
                      };
                  })(eventName));
              }
          }
  
          for (var eventKey in Types.Event) {
              var eventName = Types.Event[eventKey];
              var translatorFunction = _eventTranslatorMap[eventName];
  
              this.bot.on(eventName, _createEventDispatcher(eventName, translatorFunction, globalObject).bind(this));
          }
  
          if (initializationCompleteCallback) {
              initializationCompleteCallback(this);
          }
      }).bind(this));
  }
docs: Creates a new instance of the bot which will automatically connect to dubtrack.fm
  and set up some event handling.