Example #1
0
 def restart(self, msg, args):
     """ Restart the bot. """
     self.send(msg.frm, "Deactivating all the plugins...")
     self._bot.plugin_manager.deactivate_all_plugins()
     self.send(msg.frm, "Restarting")
     self._bot.shutdown()
     global_restart()
     return "I'm restarting..."
Example #2
0
 def restart(self, msg, args):
     """ Restart the bot. """
     self.send(msg.frm, "Deactivating all the plugins...")
     self._bot.plugin_manager.deactivate_all_plugins()
     self.send(msg.frm, "Restarting")
     self._bot.shutdown()
     global_restart()
     return "I'm restarting..."
    def self_update(self, msg, args):
        """Perform a release update of the bot."""
        if not self.BOT_UPDATE_SCRIPT:
            raise Exception("No update script configured. :persevere:")

        try:
            yield "Improving myself..."
            subprocess.call([self.BOT_UPDATE_SCRIPT])
            yield "A newer, a better me... :smile:"
            self.send(msg.frm, "Deactivating all the plugins...")
            self._bot.plugin_manager.deactivate_all_plugins()
            self.send(msg.frm, "I'm restarting now...")
            self._bot.shutdown()
            global_restart()
        except OSError:
            raise Exception("Failed to run update script... :disappointed:")