]> jfr.im git - erebus.git/blobdiff - modules/help.py
control - be aware of dependents
[erebus.git] / modules / help.py
index ff64cf0cb92663a4b30086c4cd91b644f53ba62c..299cf0a78298c930cc04b8749fbc47b8c95ac5d7 100644 (file)
@@ -80,7 +80,7 @@ class HelpLine(object):
 
 @lib.hook(needchan=False)
 @lib.help('[<command>]', 'lists commands or describes a command')
-def help(bot, user, chan, realtarget, *args): #TODO add ordering - by access level, then alphabetic?
+def help(bot, user, chan, realtarget, *args):
        if len(args) == 0: # list commands
                lines = []
                for func in helps.itervalues():
@@ -91,16 +91,15 @@ def help(bot, user, chan, realtarget, *args): #TODO add ordering - by access lev
                                                lines.append(HelpLine(c, "", "Alias of %s" % (func.cmd[0]), (user.glevel > 0), func.reqglevel, func.__module__))
                for line in sorted(lines):
                        bot.slowmsg(user, str(line))
+               bot.slowmsg(user, "End of command listing.")
        else: # help for a specific command/topic
                cmd = str(' '.join(args))
                if cmd in cmds and user.glevel >= cmds[cmd].reqglevel:
                        func = cmds[cmd]
-                       if func.reqglevel <= 0:
-                               bot.slowmsg(user, "%-40s - %-50s" % (func.cmd[0]+' '+func.syntax, func.shorthelp))
-                       else:
-                               bot.slowmsg(user, "%-40s - %-50s (%5s)" % (func.cmd[0]+' '+func.syntax, func.shorthelp, func.reqglevel))
+                       bot.slowmsg(user, str(HelpLine(func.cmd[0], func.syntax, func.shorthelp, (user.glevel > 0), func.reqglevel, func.__module__)))
                        for line in func.longhelps:
                                bot.slowmsg(user, "  %s" % (line))
+                       bot.slowmsg(user, "End of help for %s." % (func.cmd[0]))
 
                        if len(func.cmd) > 1:
                                bot.slowmsg(user, "  Aliases: %s" % (' '.join(func.cmd[1:])))