docs: function _registerEventListeners(basedir, globalObject) {
      var bot = globalObject.bot;
      var eventListenerDir = path.resolve(basedir, "event_listeners");
  
      var files;
      try {
          files = Utils.getAllFilePathsUnderDirectory(eventListenerDir);
          LOG.info("Found the following potential event listener files: {}", files);
      }
      catch (e) {
          LOG.error("Unable to register event listeners from the base directory '{}'. Error: {}", eventListenerDir, e);
          return;
      }
  
      var listeners = [];
      for (var i = 0; i < files.length; i++) {
          var filePath = files[i];
          if (filePath.lastIndexOf(".js") !== filePath.length - 3) {
              LOG.info("File {} doesn't appear to be a JS module. Ignoring.", filePath);
              continue;
          }
  
          var module = require(filePath);
  
          /* Check each event key and look for an export in one of two forms:
           *
           * 1) EVENT_KEY : some_function
           * 2) EVENT_KEY : { handler: some_function, context: some_object }
           *
           * Context is optional even in the second form, but a function is always required.
           */
          var eventHandlerFound = false;
          for (var eventKey in Event) {
              var eventValue = Event[eventKey];
              var eventHandler = null;
              var handlerContext = null;
              var error = null;
  
              if (!module[eventValue]) {
                  continue;
              }
  
              if (typeof module[eventValue] === "function") {
                  eventHandler = module[eventValue];
              }
              else if (typeof module[eventValue] === "object") {
                  if (typeof module[eventValue].handler !== "function") {
                      LOG.error("An error occurred while reading event listener from file {}", filePath);
                      LOG.error("Event listener for event '{}' has an object type, but the 'handler' property does not refer to a function", eventKey);
                      throw new Error("An error occurred while initializing event listeners. Check your logfile (or just stdout) for more details.");
                  }
  
                  eventHandler = module[eventValue].handler;
                  handlerContext = module[eventValue].context;
              }
              else {
                  LOG.warn("Found what looks like an event listener, but it's not an object or a function. Event: {}, from file: {}", eventKey, filePath);
                  continue;
              }
  
              eventHandlerFound = true;
              bot.on(eventValue, eventHandler, handlerContext);
          }
  
          if (!eventHandlerFound) {
              LOG.warn("Found a module at {} but it doesn't appear to be an event handler. Ignoring.", filePath);
              continue;
          }
  
          if (typeof module.init === "function") {
              LOG.info("Calling init for module at {}", filePath);
              module.init(globalObject);
          }
  
          listeners.push(module);
          LOG.info("Registered event listener from file {}", filePath);
      }
  
      return listeners;
  }