def handle_reload(bot, ievent): """ reload <plugin> .. reload a plugin """ try: plugs = ievent.args except IndexError: ievent.missing("<list plugins>") return reloaded = [] errors = [] for plug in plugs: plug = plug.lower() if plug == "config": config.reload() ievent.reply("config reloaded") continue p = gozer_import("gozerbot.plugs.__init__") if plug in p.__plugs__: reloaded.extend(plugins.reload("gozerbot.plugs", plug)) continue try: reloaded.extend(plugins.reload("myplugs", plug)) except ImportError, ex: try: reloaded.extend(plugins.reload("gozerplugs", plug)) except ImportError, ex: errors.append(str(ex))
def handle_reload(bot, ievent): """ reload <plugin> .. reload a plugin """ try: plugs = ievent.args except IndexError: ievent.missing('<list plugins>') return reloaded = [] errors = [] for plug in plugs: plug = plug.lower() if plug == 'config': config.reload() ievent.reply('config reloaded') continue p = gozer_import('gozerbot.plugs.__init__') if plug in p.__plugs__: reloaded.extend(plugins.reload('gozerbot.plugs', plug)) continue try: reloaded.extend(plugins.reload('myplugs', plug)) except ImportError, ex: try: reloaded.extend(plugins.reload('gozerplugs', plug)) except ImportError, ex: errors.append(str(ex))
def reboot_stateful(bot, ievent, fleet, partyline): """ reboot the bot, but keep the connections """ config.reload() session = {'bots': {}, 'name': bot.name, 'channel': ievent.channel, \ 'partyline': []} for i in fleet.bots: session['bots'].update(i._resumedata()) session['partyline'] = partyline._resumedata() sessionfile = tempfile.mkstemp('-session', 'gozerbot-')[1] dump(session, open(sessionfile, 'w')) fleet.save() fleet.exit(jabber=True) os.execl(sys.argv[0], sys.argv[0], '-r', sessionfile)