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): def bitcoin(phenny, input):
""".bitcoin <amount> <currency> [<output currency]> - Convert an
arbitrary amount of some currency to or from Bitcoin."""
amount = input.group(2) amount = input.group(2)
currency = input.group(3) currency = input.group(3)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,6 +17,8 @@ def sloganize(word):
return bytes return bytes
def slogan(phenny, input): def slogan(phenny, input):
""".slogan <term> - Come up with a slogan for a term."""
word = input.group(2) word = input.group(2)
if word is None: if word is None:
phenny.say("You need to specify a word; try .slogan Granola") 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' + 'search={0}&fulltext=Search'
def vtluug(phenny, input): def vtluug(phenny, input):
""".vtluug <term> - Look up something on the VTLUUG wiki."""
origterm = input.groups()[1] origterm = input.groups()[1]
if not origterm: if not origterm:
return phenny.say('Perhaps you meant ".vtluug VT-Wireless"?') return phenny.say('Perhaps you meant ".vtluug VT-Wireless"?')
@ -40,7 +42,6 @@ def vtluug(phenny, input):
phenny.say(result) phenny.say(result)
else: else:
phenny.say('Can\'t find anything in the VTLUUG Wiki for "{0}".'.format(origterm)) phenny.say('Can\'t find anything in the VTLUUG Wiki for "{0}".'.format(origterm))
vtluug.commands = ['vtluug'] vtluug.commands = ['vtluug']
vtluug.priority = 'high' vtluug.priority = 'high'

View File

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

View File

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

View File

@ -14,7 +14,9 @@ re.MULTILINE
r_play = re.compile(r'^(.*?) - (.*?)$') r_play = re.compile(r'^(.*?) - (.*?)$')
r_dj = re.compile(r'Current DJ: </span>\n(.+?)<') 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: try:
playing = web.get('http://www.wuvt.vt.edu/playlists/latest_track.php') playing = web.get('http://www.wuvt.vt.edu/playlists/latest_track.php')
djpage = web.get('http://www.wuvt.vt.edu/playlists/current_dj.php') djpage = web.get('http://www.wuvt.vt.edu/playlists/current_dj.php')