-def modunload(bot, user, chan, realtarget, *args):
- okay = ctlmod.unload(bot.parent, args[0])
+def modunload(bot, user, chan, realtarget, flags, *args):
+ autoload = flags['autoload']
+ force = flags['force']
+ module = args[0]
+
+ if autoload:
+ bot.parent.cfg.delete('autoloads', module)
+ bot.msg(user, "Unmarked %s for autoloading." % (module))
+ if not ctlmod.isloaded(module):
+ bot.msg(user, "%s is not loaded" % (module))
+ return
+ if len(ctlmod.dependents[module]) > 0:
+ if not force:
+ bot.msg(user, "That module has dependents! Say MODUNLOAD -force %s to unload it and any dependents." % (module))
+ return
+
+ okay = ctlmod.unload(bot.parent, module)