From bce7d2086371d534cc8cb19ae0adfc22f85d39d9 Mon Sep 17 00:00:00 2001 From: Matthew Vernon Date: Thu, 6 Aug 2009 13:29:00 +0100 Subject: [PATCH] add the help command back to #chiarks servus instance; sort the output from the list command --- Servus-chiark.py | 3 ++- commands.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Servus-chiark.py b/Servus-chiark.py index 128300a..a0ba8a5 100644 --- a/Servus-chiark.py +++ b/Servus-chiark.py @@ -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. diff --git a/commands.py b/commands.py index 4bdc45c..eac4bc3 100644 --- a/commands.py +++ b/commands.py @@ -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 -- 2.30.2