chiark / gitweb /
add the help command back to #chiarks servus instance; sort the output from the list...
authorMatthew Vernon <matthew@rapun.sel.cam.ac.uk>
Thu, 6 Aug 2009 12:29:00 +0000 (13:29 +0100)
committerMatthew Vernon <matthew@rapun.sel.cam.ac.uk>
Thu, 6 Aug 2009 12:29:00 +0000 (13:29 +0100)
Servus-chiark.py
commands.py

index 128300a..a0ba8a5 100644 (file)
@@ -160,6 +160,7 @@ commands = {"karma": (c.karmaq,karmadb),
            "die": quit,
             "google": c.googleq,
            "units": c.unitq,
+           "help": c.helpq,
 #          "define": c.defineq,
 #          "game": (c.gameq,game),
             "say": c.sayq,
@@ -167,7 +168,7 @@ commands = {"karma": (c.karmaq,karmadb),
 # disconnect and hop annoy people
 #            "disconnect": c.disconnq,
 #            "hop": c.disconnq }
-commands["list"]=(c.listkeysq,commands)
+commands["list"]=(c.listkeysq,commands,True)
 
 triggers = ("!", "~") # what character should the bot be invoked by:
                       # eg !trout, ~trout etc.
index 4bdc45c..eac4bc3 100644 (file)
@@ -280,8 +280,11 @@ def disconnq(bot, cmd, nick, conn, public):
         bot.disconnect(msg="Be right back.")
 
 ### list keys of a dictionary
-def listkeysq(bot, cmd, nick, conn, public, dict):
-    bot.automsg(public,nick,string.join(dict.keys()))
+def listkeysq(bot, cmd, nick, conn, public, dict, sort=False):
+    d=dict.keys()
+    if sort:
+        d.sort()
+    bot.automsg(public,nick,string.join(d))
 
 ### rot13 text (yes, I could have typed out the letters....)
 ### also "foo".encode('rot13') would have worked