def handle_plugenable(bot, event): """ arguments" <plugname> - enable a plugin. """ if not event.rest: event.missing("<plugname>") ; return if "." in event.rest: mod = event.rest else: mod = bot.plugs.getmodule(event.rest) if not mod: event.reply("can't find module for %s" % event.rest) ; return event.reply("reloading and enabling %s" % mod) plugenable(mod) bot.do_enable(mod) bot.plugs.reload(mod, force=True, showerror=True) update_mod(mod) event.done()
def handle_plugenable(bot, event): """ arguments" <plugname> - enable a plugin. """ if not event.rest: event.missing("<plugname>") return if "." in event.rest: mod = event.rest else: mod = bot.plugs.getmodule(event.rest) if not mod: event.reply("can't find module for %s" % event.rest) return event.reply("reloading and enabling %s" % mod) plugenable(mod) bot.do_enable(mod) bot.plugs.reload(mod, force=True, showerror=True) update_mod(mod) event.done()
return reloaded = [] errors = [] for plug in pluglist: modname = bot.plugs.getmodule(plug) if not modname: errors.append("can't find %s plugin" % plug) ; continue if not isenabled(modname): ievent.reply("%s is not enabled, use the plug-enabled command for that" % plug) ; continue try: loaded = bot.plugs.reload(modname, force=True, showerror=True) for plug in loaded: reloaded.append(plug) logging.warn("%s reloaded" % plug) except RequireError, ex: errors.append(str(ex)) ; continue except NoSuchPlugin: errors.append("can't find %s plugin" % plug) ; continue except Exception, ex: if 'No module named' in str(ex) and plug in str(ex): logging.info('%s - %s' % (modname, str(ex))) continue errors.append(exceptionmsg()) for modname in reloaded: if modname: update_mod(modname) if reloaded: ievent.reply('reloaded: ', reloaded) else: ievent.reply("nothing to reload") if errors: t = ievent.jid or ievent.nick or ievent.channel bot.say(t, 'errors: ', errors) ievent.reply("there were errors (send to %s)" % t) cmnds.add('plug-reload', handle_plugreload, 'OPER') examples.add('plug-reload', 'plug-reload <plugin>', 'plug-reload core')
plug) continue try: loaded = bot.plugs.reload(modname, force=True, showerror=True) for plug in loaded: reloaded.append(plug) logging.warn("%s reloaded" % plug) except RequireError, ex: errors.append(str(ex)) continue except NoSuchPlugin: errors.append("can't find %s plugin" % plug) continue except Exception, ex: if 'No module named' in str(ex) and plug in str(ex): logging.info('%s - %s' % (modname, str(ex))) continue errors.append(exceptionmsg()) for modname in reloaded: if modname: update_mod(modname) if reloaded: ievent.reply('reloaded: ', reloaded) else: ievent.reply("nothing to reload") if errors: t = ievent.jid or ievent.nick or ievent.channel bot.say(t, 'errors: ', errors) ievent.reply("there were errors (send to %s)" % t) cmnds.add('plug-reload', handle_plugreload, 'OPER') examples.add('plug-reload', 'plug-reload <plugin>', 'plug-reload core')