Help can return over two lines.

This commit is contained in:
Fletcher Boyd 2013-09-06 11:51:01 +08:00
parent 363d0ba6d9
commit d39e101f45

View file

@ -23,20 +23,23 @@ def help(inp, notice=None, input=None, conn=None, bot=None):
commands = dict((value, key) for key, value in funcs.iteritems()) commands = dict((value, key) for key, value in funcs.iteritems())
if not inp: if not inp:
out = ["", ""] out = [""]
well = [] well = []
for x in commands: for x in commands:
well.append(x) well.append(x)
well.sort() well.sort()
count = 0
for x in well: for x in well:
if len(out[0]) + len(str(x)) > 405: if len(out[count]) + len(str(x)) > 405:
out[1] += " " + str(x) count += 1
out.append(str(x))
else: else:
out[0] += " " + str(x) out[count] += " " + str(x)
notice("Commands I recognise: " + out[0][1:]) notice("Commands I recognise: " + out[0][1:])
if out[1]: if len(out) > 1:
notice(out[1][1:]) for x in out[1:]:
notice(x)
notice("For detailed help, do '%shelp <example>' where <example> " notice("For detailed help, do '%shelp <example>' where <example> "
"is the name of the command you want help for." % conn.conf["command_prefix"]) "is the name of the command you want help for." % conn.conf["command_prefix"])