standardised multiline command docstrings

This commit is contained in:
Luke Rogers 2012-03-23 14:51:34 +13:00
parent 549bb70690
commit 954ea57fce
7 changed files with 8 additions and 7 deletions

View file

@ -36,7 +36,7 @@ answers = [g + "As I see it, yes",
@hook.command('8ball') @hook.command('8ball')
def eightball(inp, me=None): def eightball(inp, me=None):
".8ball <question> -- The all knowing magic eight ball, "\ ".8ball <question> -- The all knowing magic eight ball, " \
"in electronic form. Ask and it shall be answered!" "in electronic form. Ask and it shall be answered!"
global nextresponsenumber global nextresponsenumber
inp = inp.strip() inp = inp.strip()

View file

@ -10,6 +10,7 @@ from util import hook
BUFFER_SIZE = 5000 BUFFER_SIZE = 5000
MAX_STEPS = 1000000 MAX_STEPS = 1000000
@hook.command('brainfuck') @hook.command('brainfuck')
@hook.command @hook.command
def bf(inp): def bf(inp):

View file

@ -6,7 +6,7 @@ from util import hook
@hook.command @hook.command
def choose(inp): def choose(inp):
".choose <choice1>, [choice2], [choice3], [choice4], ... -- "\ ".choose <choice1>, [choice2], [choice3], [choice4], ... -- " \
"Randomly picks one of the given choices." "Randomly picks one of the given choices."
c = re.findall(r'([^,]+)', inp) c = re.findall(r'([^,]+)', inp)

View file

@ -37,7 +37,7 @@ def nrolls(count, n):
#@hook.regex(valid_diceroll, re.I) #@hook.regex(valid_diceroll, re.I)
@hook.command @hook.command
def dice(inp): def dice(inp):
".dice <diceroll> -- Simulates dicerolls. Example of <diceroll>:" ".dice <diceroll> -- Simulates dicerolls. Example of <diceroll>:" \
" '.dice 2d20-d5+4 roll 2'. D20s, subtract 1D5, add 4" " '.dice 2d20-d5+4 roll 2'. D20s, subtract 1D5, add 4"
try: # if inp is a re.match object... try: # if inp is a re.match object...

View file

@ -5,7 +5,7 @@ import urllib2
@hook.command @hook.command
def gitio(inp): def gitio(inp):
".gitio <url> [code] -- Shorten Github URLs with git.io. [code] is" ".gitio <url> [code] -- Shorten Github URLs with git.io. [code] is" \
" a optional custom short code." " a optional custom short code."
split = inp.split(" ") split = inp.split(" ")
url = split[0] url = split[0]

View file

@ -115,7 +115,7 @@ def get_quote_by_chan(db, chan, num=False):
@hook.command @hook.command
def quote(inp, nick='', chan='', db=None, notice=None): def quote(inp, nick='', chan='', db=None, notice=None):
".quote [#chan] [nick] [#n]/.quote add <nick> <msg> -- Gets " \ ".quote [#chan] [nick] [#n]/.quote add <nick> <msg> -- Gets " \
"random or [#n]th quote by <nick> or from <#chan>/adds quote." "random or [#n]th quote by <nick> or from <#chan>/adds quote."
create_table_if_not_exists(db) create_table_if_not_exists(db)
add = re.match(r"add[^\w@]+(\S+?)>?\s+(.*)", inp, re.I) add = re.match(r"add[^\w@]+(\S+?)>?\s+(.*)", inp, re.I)

View file

@ -5,8 +5,8 @@ from util import hook, http
@hook.command(autohelp=False) @hook.command(autohelp=False)
def forecast(inp, nick='', server='', def forecast(inp, nick='', server='',
reply=None, db=None, notice=None, say=None): reply=None, db=None, notice=None, say=None):
".forecast <location> [dontsave] -- Gets a weather forecast "\ ".forecast <location> [dontsave] -- Gets a weather forecast" \
"for <location> from Google." " for <location> from Google."
loc = inp loc = inp
dontsave = loc.endswith(" dontsave") dontsave = loc.endswith(" dontsave")