Did a bunch of tweaks

This commit is contained in:
Luke Rogers 2012-02-20 00:00:51 +13:00
parent 50d6840628
commit 7c1fd68948
3 changed files with 8 additions and 6 deletions

View file

@ -39,9 +39,11 @@ def help(inp, input=None, bot=None, say=None, notice=None):
else:
out[0] += " " + str(x)
notice(out[0][1:])
notice("Commands I recognise: " + out[0][1:])
if out[1]:
notice(out[1][1:])
notice("For help, do '.help example' where example is the " +
"name of the command you want help for.")

View file

@ -49,11 +49,11 @@ def get_quote_num(num, count, name):
if num: # Make sure num is a number if it isn't false
num = int(num)
if count == 0: # If there are no quotes in the database, raise an Exception.
raise Exception("No quotes found for %s" % name)
raise Exception("No quotes found for %s." % name)
if num and num < 0: # If the selected quote is less than 0, count back if possible.
num = count + num + 1 if num + count > -1 else count + 1
if num and num > count: # If a number is given and and there are not enough quotes, raise an Exception.
raise Exception("I only have %d quote%s for %s" % (count, ('s', '')[count == 1], name))
raise Exception("I only have %d quote%s for %s." % (count, ('s', '')[count == 1], name))
if num and num == 0: # If the number is zero, set it to one
num = 1
if not num: # If a number is not given, select a random one
@ -104,7 +104,7 @@ def get_quote_by_chan(db, chan, num=False):
@hook.command('q')
@hook.command
def quote(inp, nick='', chan='', db=None):
def quote(inp, nick='', chan='', db=None, notice=None):
".q/.quote [#chan] [nick] [#n]/.quote add <nick> <msg> -- gets " \
"random or [#n]th quote by <nick> or from <#chan>/adds quote"
create_table_if_not_exists(db)
@ -127,4 +127,4 @@ def quote(inp, nick='', chan='', db=None):
chan, nick, num = retrieve_chan.groups()
return get_quote_by_nick(db, chan, nick, num)
return quote.__doc__
notice(quote.__doc__)

View file

@ -48,4 +48,4 @@ def wiki(inp):
if len(desc) > 300:
desc = desc[:300] + '...'
return '%s -- %s' % (desc, http.quote(url, ':/'))
return '%s :: %s' % (desc, http.quote(url, ':/'))