modstop = lib.modstop
# module code
+import functools
import os.path
helps = {}
cmds = {}
del cmds[c]
del helps[func]
+@functools.total_ordering
class HelpLine(object):
def __init__(self, cmd, syntax, shorthelp, admin, glevel, module, clevel):
self.cmd = cmd
self.module = module
self.clevel = clevel
+ def __lt__(self, other):
+ if self.glevel == other.glevel:
+ return self.cmd < other.cmd
+ else:
+ return self.glevel < other.glevel
+
+ def __eq__(self, other):
+ return self.glevel == other.glevel and self.cmd == other.cmd
+
def __cmp__(self, other):
if self.glevel == other.glevel:
return cmp(self.cmd, other.cmd)
if len(args) == 0: # list commands
lines = []
for func in helps.values():
- lines += _mkhelp(user, func)
+ lines += _mkhelp(user.glevel, func)
for line in sorted(lines):
bot.slowmsg(user, str(line))
bot.slowmsg(user, "End of command listing.")
mod = args[0][1:].lower()
for func in helps.values():
if func.module == mod:
- lines += _mkhelp(user, func)
+ lines += _mkhelp(user.glevel, func)
for line in sorted(lines):
bot.slowmsg(user, str(line))
bot.slowmsg(user, "End of command listing.")