]> jfr.im git - erebus.git/commitdiff
help - make response format match for cmd list vs single cmd
authorzonidjan <redacted>
Thu, 8 Jun 2017 02:12:09 +0000 (21:12 -0500)
committerzonidjan <redacted>
Thu, 8 Jun 2017 02:12:09 +0000 (21:12 -0500)
modules/help.py

index ff64cf0cb92663a4b30086c4cd91b644f53ba62c..8d79721adb9c0b3a48cf6e6d559b76de164dab99 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():
@@ -95,10 +95,7 @@ def help(bot, user, chan, realtarget, *args): #TODO add ordering - by access lev
                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))