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 128300a53822a3e28429c9a0f1c29647fe1f440f..a0ba8a5189a0d2060f4b6d635293f91c6309e8c5 100644 (file)
@@ -160,6 +160,7 @@ commands = {"karma": (c.karmaq,karmadb),
            "die": quit,
             "google": c.googleq,
            "units": c.unitq,
            "die": quit,
             "google": c.googleq,
            "units": c.unitq,
+           "help": c.helpq,
 #          "define": c.defineq,
 #          "game": (c.gameq,game),
             "say": c.sayq,
 #          "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 }
 # 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.
 
 triggers = ("!", "~") # what character should the bot be invoked by:
                       # eg !trout, ~trout etc.
index 4bdc45ce01dcc632ae861a4194ced4a9f5c48aed..eac4bc3ce0ee50ccdef0ab088675c27742764b26 100644 (file)
@@ -280,8 +280,11 @@ def disconnq(bot, cmd, nick, conn, public):
         bot.disconnect(msg="Be right back.")
 
 ### list keys of a dictionary
         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
 
 ### rot13 text (yes, I could have typed out the letters....)
 ### also "foo".encode('rot13') would have worked