Add command for bot to clear the room history (requires client reload).
e.g. "bot clr" or "@bot clear room" or "bot clr from June 3, 2018 17:30".
@param {Robot} robot The Hubot instance
165351
function load (robot) {
  robot.respond(/\b(clean room|clr)( from (.*))?(\.|!|)?$/i, async (res) => {
    try {
      const from = res.match[3] || 'May 19, 2015 04:36:09' // clear all if not given date
      const oldest = new Date(from).toISOString()
      const cleaned = await cleanRoomHistory(robot, res.message.user, oldest).catch()
      if (typeof cleaned === 'undefined') {
        res.reply(`Sorry, I'm afraid I can't do that.`)
      }
    } catch (err) {
      res.reply(`That wasn't a valid date`)
    }
  })
}
225858
def leave_command_mode(self, append_to_history=False):
        
        self.previewer.restore()

        self.application.layout.focus_last()
        self.application.vi_state.input_mode = InputMode.NAVIGATION

        self.command_buffer.reset(append_to_history=append_to_history)
887389
def run_bots(bots):
    
    greenlets = [spawn(bot.run) for bot in bots]
    try:
        joinall(greenlets)
    except KeyboardInterrupt:
        for bot in bots:
            bot.disconnect()
    finally:
        killall(greenlets)
973786
public Response deleteMember(String roomName, String jid) {
		return restClient.delete("chatrooms/" + roomName + "/members/" + jid,
				new HashMap<String, String>());
	}
890504
function initSerial(robot, port, callback) {
	serial = new Serial.SerialPort(port, {
		//Defaults for Roomba Open Interface:
		baudrate:115200, dataBits:8,
		parity:'none', stopBits:1,
		flowControl:false
	});
	serial.on('open', function() {
		//Send Start Command:
		serial.write(Buffer([128]));
		setSensorRead(true, robot);
		//Listen to Incoming Data:
		serial.on('data', function(data) {
			//Combine Previous Data:
			if(robot.inputBuffer) {
				robot.inputBuffer = Buffer.concat([robot.inputBuffer,
				data], robot.inputBuffer.length + data.length);
			} else robot.inputBuffer = data;
			//Data Parsing Timer:
			if(robot.inputTimer) clearTimeout(robot.inputTimer);
			robot.inputTimer = setTimeout(function() {
				if(robot.dataParser && robot.inputBuffer && robot.inputBuffer.length >= 80)
				{ robot.dataParser(robot.inputBuffer); robot.inputBuffer = robot.inputTimer = null; }
				if(exports.debug && robot.inputBuffer && robot.inputBuffer.length != 80)
				console.log(chalk.bold.green("Packet Miss ["+robot.inputBuffer.length+"]"));
			}, 5);
		});
		if(callback) callback(robot);
	});
	return serial;
}
1198032
function cleanup()
    {
      if(chan.timer) clearTimeout(chan.timer);
      chan.timer = setTimeout(function(){
        chan.state = "gone"; // in case an app has a reference
        x.channels[chan.id] = {state:"gone"}; // remove our reference for gc
      }, chan.timeout);
    }
647339
function (session) {
  this.session = session;
  this.koc_session_cookie_name = "koc_session";
  this.koc_host = "http://www.kingsofchaos.com";
  this.koc_recaptcha_url = "http://www.google.com/recaptcha/api/challenge";
  this.koc_recaptcha_reload_url = "http://www.google.com/recaptcha/api/reload";
  this.koc_recaptcha_key = "6LcvaQQAAAAAACnjh5psIedbdyYzGDb0COW82ruo";
  this.recaptcha_image_format = "%simage?c=%s"; // path to the ReCaptcha image from (server, challenge)
  this.location = "";
  this.stats = {};
  this.username = "???";
  this.help = ""; // Help from the New User Advisor, if present
  this.parser = require('./parser');
  this.age = 0;
  this.menu = [];
  this.default_commander_change_statement = "Yes, I am sure I want to change commanders.";
}
671597
function(command) {
			this._commandList[command.id] = command;
			// Resolve any pending key/url bindings against this command
			var pending = this._pendingBindings[command.id];
			if (pending) {
				var _self = this;
				pending.forEach(function(binding) {
					_self._addBinding(command, binding.type, binding.binding, binding.bindingOnly);
				});
				delete this._pendingBindings[command.id];
			}
		}
1093553
function createBot() {
  var bot = function(platform, context, event, next) {
    context.platform = platform;
    bot.handle(context, event, next);
  };

  mixin(bot, EventEmitter.prototype, false);
  mixin(bot, proto, false);

  bot.context = { __proto__: context, bot: bot };
  bot.event = { __proto__: event, bot: bot };
  bot.display_name = "bot"; // default, should be overwritten
  bot.init();
  return bot;
}
326204
function() {
            self._client.roomState(roomId).then(function(events) {
                events.forEach(function(ev) {
                    if (self._eventTypes[ev.type]) {
                        if (!r.events[ev.type]) {
                            r.events[ev.type] = {};
                        }
                        r.events[ev.type][ev.state_key] = ev;
                    }
                });
                resolve(r);
            }, function(err) {
                if (err.httpStatus >= 400 && err.httpStatus < 600) { // 4xx, 5xx
                    reject(err); // don't have permission, don't retry.
                }
                // wait a bit then try again
                Promise.delay(3000).then(function() {
                    if (!self._dict[roomId]) {
                        return;
                    }

                    queryRoomState();
                });
            });
        }
18090
function() {
        clearInterval(this._checkConnectionTimer);
        this._checkConnectionTimer = undefined;
        this.muc.joinedRooms = {};
        this._isLogout = true;
        this.helpers.setUserCurrentJid('');

        if (Utils.getEnv().browser) {
            this.connection.flush();
            this.connection.disconnect();
        } else {
            this.Client.end();
        }
    }
1239135
protected void addToHistory (String cmd)
    {
        // remove any previous instance of this command
        _history.remove(cmd);

        // append it to the end
        _history.add(cmd);

        // prune the history once it extends beyond max size
        if (_history.size() > MAX_COMMAND_HISTORY) {
            _history.remove(0);
        }
    }
372829
function setupBotStatus(bot, node) {
    var updates = 0;
    var replies = 0;
    var updateText = function updateText() {
        return updates !== 1 ? updates + ' updates' : updates + ' update';
    };
    var replyText= function replyText() {
        return replies !== 1 ? replies + ' replies': replies + ' reply';
    };
    var updateStatus = function updateStatus() {
        node.status({fill: 'green', shape: 'dot',
            text: updateText() + '; ' + replyText()
        });
    };
    node.status({fill: 'grey', shape: 'ring', text: 'inactive'});
    bot.on('update', function updateCallback() {
        updates += 1;
        updateStatus();
    });

    bot.on('error', function errorCallback(error) {
        node.error(error);
        node.status({fill: 'red', shape: 'dot', text: 'error'});
    });

    bot.use('outgoing', function outgoingCallback(bot, update, message, next) {
        replies += 1;
        updateStatus();
        next();
    });
}
340329
function (cb) {
            if (!this._robot) {
                this._robot = Aria.$frameworkWindow.top.SeleniumJavaRobot;
                this._robot.getOffset({
                    fn : this._offsetReceived,
                    scope : this
                });
            }
            if (cb) {
                if (this._robotInitialized) {
                    this.$callback(cb);
                } else {
                    this.$onOnce({
                        "robotInitialized" : cb
                    });
                }
            }
        }
855873
protected function setRobot()
    {
        if (is_array(static::$robots) && count(static::$robots) > 0) {
            foreach (static::$robots as $key => $val) {
                if (preg_match('|' . preg_quote($key) . '|i', $this->string)) {
                    $this->isRobot = true;
                    $this->robot = $val;
                    $this->setMobile();

                    return true;
                }
            }
        }

        return false;
    }
228237
public void startRobot(Robot newRobot) {
	newRobot.getData().setActiveState(DEFAULT_START_STATE);
	Thread newThread = new Thread(robotsThreads, newRobot, "Bot-" + newRobot.getSerialNumber());
	newThread.start(); // jumpstarts the robot

    }
118009
public void setRobotApplicationNames(java.util.Collection<String> robotApplicationNames) {
        if (robotApplicationNames == null) {
            this.robotApplicationNames = null;
            return;
        }

        this.robotApplicationNames = new java.util.ArrayList<String>(robotApplicationNames);
    }