return lines
def _genhelp(bot, user, chan, realtarget, *args):
return lines
def _genhelp(bot, user, chan, realtarget, *args):
- for level in range(-1, 101):
- filename = filepath % (level)
+ for arg in args:
+ if arg.startswith("@"):
+ module = arg[1:]
+ elif arg.startswith("#") and user.glevel >= lib.ADMIN:
+ minlevel = maxlevel = int(arg[1:])
+ else:
+ filepath = arg
+ if minlevel != maxlevel:
+ minlevel = maxlevel
+ for level in range(minlevel, maxlevel+1):
+ if '%d' in filepath:
+ filename = filepath % (level)
+ else:
+ filename = filepath
lines += _mkhelp(level, func)
for line in sorted(lines):
fo.write(str(line)+"\n")
lines += _mkhelp(level, func)
for line in sorted(lines):
fo.write(str(line)+"\n")
-@lib.help(None, "generates help file", "default path: ./help/<level>.txt", "config as: [help]", "path = ./help/%d.txt")
+@lib.help("[@<module>] [#<level>] [file]", "generates help file", "arguments are all optional and may be specified in any order", "default file: ./help/<level>.txt", "config as: [help]", "path = ./help/%d.txt")
def genhelp(bot, user, chan, realtarget, *args):
try:
_genhelp(bot, user, chan, realtarget, *args)
def genhelp(bot, user, chan, realtarget, *args):
try:
_genhelp(bot, user, chan, realtarget, *args)
bot.slowmsg(user, str(HelpLine(func.cmd[0], func.syntax, func.shorthelp, (user.glevel > 0), func.reqglevel, func.module, func.reqclevel)))
for line in func.longhelps:
bot.slowmsg(user, " %s" % (line))
bot.slowmsg(user, str(HelpLine(func.cmd[0], func.syntax, func.shorthelp, (user.glevel > 0), func.reqglevel, func.module, func.reqclevel)))
for line in func.longhelps:
bot.slowmsg(user, " %s" % (line))
for line in sorted(lines):
bot.slowmsg(user, str(line))
bot.slowmsg(user, "End of command listing.")
for line in sorted(lines):
bot.slowmsg(user, str(line))
bot.slowmsg(user, "End of command listing.")