add help for a bunch of modules

master
mutantmonkey 2013-10-05 16:20:37 -07:00
parent 6606bf18ad
commit 256592b79f
12 changed files with 45 additions and 22 deletions

View File

@ -9,6 +9,9 @@ import web
def bitcoin(phenny, input):
""".bitcoin <amount> <currency> [<output currency]> - Convert an
arbitrary amount of some currency to or from Bitcoin."""
amount = input.group(2)
currency = input.group(3)

View File

@ -9,6 +9,8 @@ import random
otherbot = "truncatedcone"
def botfight(phenny, input):
""".botfight - Fight the other bot in the channel."""
messages = ["hits %s", "punches %s", "kicks %s", "hits %s with a rubber hose", "stabs %s with a clean kitchen knife"]
response = random.choice(messages)
@ -17,6 +19,8 @@ botfight.commands = ['botfight']
botfight.priority = 'low'
def bothug(phenny, input):
""".bothug - Hug the other bot in the channel."""
phenny.do("hugs %s" % otherbot)
bothug.commands = ['bothug']
bothug.priority = 'low'

View File

@ -36,6 +36,7 @@ def decrease_hunger(current_hunger, food_value):
return current_hunger + food_value
def botsnack(phenny, input):
""".botsnack - Feed me a bot snack."""
now = time.time()

View File

@ -18,7 +18,9 @@ def catfacts_get():
return False
def catfacts(phenny, input):
""".catfact - Receive a cat fact."""
fact = catfacts_get()
if fact:
phenny.reply(fact)
catfacts.commands = ['catfacts']
catfacts.commands = ['catfact', 'catfacts']

View File

@ -12,26 +12,29 @@ import web
def imdb_search(query):
query = query.replace('!', '')
query = query.encode('utf-8')
query = web.quote(query)
uri = 'http://www.omdbapi.com/?i=&t=%s' % query
bytes = web.get(uri)
m = json.loads(bytes)
return m
query = query.replace('!', '')
query = query.encode('utf-8')
query = web.quote(query)
uri = 'http://www.omdbapi.com/?i=&t=%s' % query
bytes = web.get(uri)
m = json.loads(bytes)
return m
def imdb(phenny, input):
query = input.group(2)
if not query:
return phenny.say('.imdb what?')
""".imdb <movie> - Use the OMDB API to find a link to a movie on IMDb."""
m = imdb_search(query)
try:
phenny.say('{0} ({1}): {2} http://imdb.com/title/{3}'.format(
m['Title'],
m['Year'],
m['Plot'],
m['imdbID']))
except:
query = input.group(2)
if not query:
return phenny.say('.imdb what?')
m = imdb_search(query)
try:
phenny.say('{0} ({1}): {2} http://imdb.com/title/{3}'.format(
m['Title'],
m['Year'],
m['Plot'],
m['imdbID']))
except:
phenny.reply("No results found for '%s'." % query)
imdb.commands = ['imdb']

View File

@ -11,7 +11,7 @@ import lxml.html
def fml(phenny, input):
""".fml"""
""".fml - Grab something from fmylife.com."""
try:
req = web.get("http://www.fmylife.com/random")
except:

View File

@ -5,6 +5,7 @@ author: Casey Link <unnamedrambler@gmail.com
"""
def nsfw(phenny, input):
""".nsfw <link> - Mark a link (or some text) as being not safe for work."""
link = input.group(2)
if not link:
phenny.say(".nsfw <link> - for when a link isn't safe for work")

View File

@ -17,6 +17,8 @@ def sloganize(word):
return bytes
def slogan(phenny, input):
""".slogan <term> - Come up with a slogan for a term."""
word = input.group(2)
if word is None:
phenny.say("You need to specify a word; try .slogan Granola")

View File

@ -20,6 +20,8 @@ wikisearch = 'https://vtluug.org/wiki/Special:Search?' \
+ 'search={0}&fulltext=Search'
def vtluug(phenny, input):
""".vtluug <term> - Look up something on the VTLUUG wiki."""
origterm = input.groups()[1]
if not origterm:
return phenny.say('Perhaps you meant ".vtluug VT-Wireless"?')
@ -40,7 +42,6 @@ def vtluug(phenny, input):
phenny.say(result)
else:
phenny.say('Can\'t find anything in the VTLUUG Wiki for "{0}".'.format(origterm))
vtluug.commands = ['vtluug']
vtluug.priority = 'high'

View File

@ -17,6 +17,8 @@ wikisearch = 'https://en.wikipedia.org/wiki/Special:Search?' \
+ 'search={0}&fulltext=Search'
def wik(phenny, input):
""".wik <term> - Look up something on Wikipedia."""
origterm = input.groups()[1]
if not origterm:
return phenny.say('Perhaps you meant ".wik Zen"?')

View File

@ -90,6 +90,8 @@ def format(word, definitions, number=2):
return result.strip(' .,')
def w(phenny, input):
""".w <word> - Get the definition of a word from wiktionary."""
if not input.group(2):
return phenny.reply("Nothing to define.")
word = input.group(2)

View File

@ -14,7 +14,9 @@ re.MULTILINE
r_play = re.compile(r'^(.*?) - (.*?)$')
r_dj = re.compile(r'Current DJ: </span>\n(.+?)<')
def wuvt(phenny, input) :
def wuvt(phenny, input):
""".wuvt - Find out what is currently playing on the radio station WUVT."""
try:
playing = web.get('http://www.wuvt.vt.edu/playlists/latest_track.php')
djpage = web.get('http://www.wuvt.vt.edu/playlists/current_dj.php')