From 8c654d1869fd0e1e73a1550f919de1e194951bbb Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 31 Aug 2012 01:52:46 -0400 Subject: [PATCH] Fixes for do_help(). --- earwigbot/commands/notes.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/earwigbot/commands/notes.py b/earwigbot/commands/notes.py index c0fc691..a54bd84 100644 --- a/earwigbot/commands/notes.py +++ b/earwigbot/commands/notes.py @@ -22,6 +22,7 @@ from datetime import datetime from os import path +import re import sqlite3 as sqlite from threading import Lock @@ -62,14 +63,20 @@ class Notes(Command): def do_help(self, data): """Get help on a subcommand.""" - help = { + info = { "help": "Get help on other subcommands.", - "list": "List existing entries." - "read": "Read an existing entry ('!notes read [name]')." - "edit": "Modify or create a new entry ('!notes edit name [entry content]...')." - "info": "Get information on an existing entry ('!notes info [name]')." - "rename": "Rename an existing entry ('!notes rename [old_name] [new_name]')." - "delete": "Delete an existing entry ('!notes delete [name]')." + "list": "List existing entries.", + "read": "Read an existing entry ('!notes read [name]').", + "edit": """Modify or create a new entry ('!notes edit name + [entry content]...'). If modifying, you must be the + entry author or a bot admin.""", + "info": """Get information on an existing entry ('!notes info + [name]').""", + "rename": """Rename an existing entry ('!notes rename [old_name] + [new_name]'). You must be the entry author or a bot + admin.""", + "delete": """Delete an existing entry ('!notes delete [name]'). You + must be the entry author or a bot admin.""", } try: @@ -78,8 +85,8 @@ class Notes(Command): self.reply(data, "Please specify a subcommand to get help on.") return try: - prefix = "\x0303{0}\x0F: ".format(command) - self.reply(data, prefix + help[command]) + help_ = re.sub(r"\s\s+", " ", info[command].replace("\n", "")) + self.reply(data, "\x0303{0}\x0F: ".format(command) + help_) except KeyError: msg = "Unknown subcommand: \x0303{0}\x0F.".format(command) self.reply(data, msg)