pep8 much?
This commit is contained in:
parent
e77e45d8b8
commit
ed50bc746c
33 changed files with 92 additions and 99 deletions
|
@ -22,6 +22,7 @@ def urban(inp):
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
# define plugin by GhettoWizard & Scaevolus
|
# define plugin by GhettoWizard & Scaevolus
|
||||||
@hook.command('dictionary')
|
@hook.command('dictionary')
|
||||||
@hook.command
|
@hook.command
|
||||||
|
|
|
@ -25,4 +25,3 @@ def drama(inp):
|
||||||
return '%s :: \x02%s\x02' % (summary, url)
|
return '%s :: \x02%s\x02' % (summary, url)
|
||||||
|
|
||||||
return "error"
|
return "error"
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,10 @@ def fact(inp, say=False, nick=False):
|
||||||
try:
|
try:
|
||||||
fact, link = get_fact()
|
fact, link = get_fact()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return u"%s [ %s ]" % (fact, link)
|
return u"%s [ %s ]" % (fact, link)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_fact():
|
def get_fact():
|
||||||
page = http.get('http://www.omg-facts.com/random')
|
page = http.get('http://www.omg-facts.com/random')
|
||||||
soup = BeautifulSoup(page)
|
soup = BeautifulSoup(page)
|
||||||
|
|
|
@ -37,6 +37,7 @@ def multiwordReplace(text, wordDic):
|
||||||
the associated value, return the changed text
|
the associated value, return the changed text
|
||||||
"""
|
"""
|
||||||
rc = re.compile('|'.join(map(re.escape, wordDic)))
|
rc = re.compile('|'.join(map(re.escape, wordDic)))
|
||||||
|
|
||||||
def translate(match):
|
def translate(match):
|
||||||
return wordDic[match.group(0)]
|
return wordDic[match.group(0)]
|
||||||
return rc.sub(translate, text)
|
return rc.sub(translate, text)
|
||||||
|
@ -50,7 +51,6 @@ def remember(inp, nick='', db=None, say=None, input=None, notice=None):
|
||||||
return
|
return
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
|
||||||
|
|
||||||
append = False
|
append = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -87,6 +87,7 @@ def remember(inp, nick='', db=None, say=None, input=None, notice=None):
|
||||||
notice('Remembered!')
|
notice('Remembered!')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@hook.command("f")
|
@hook.command("f")
|
||||||
def forget(inp, db=None, input=None, notice=None):
|
def forget(inp, db=None, input=None, notice=None):
|
||||||
".forget <word> -- Forgets a remembered <word>."
|
".forget <word> -- Forgets a remembered <word>."
|
||||||
|
@ -107,6 +108,7 @@ def forget(inp, db=None, input=None, notice=None):
|
||||||
notice("I don't know about that.")
|
notice("I don't know about that.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
@hook.command("info")
|
@hook.command("info")
|
||||||
@hook.regex(r'^\? ?(.+)')
|
@hook.regex(r'^\? ?(.+)')
|
||||||
def question(inp, say=None, db=None):
|
def question(inp, say=None, db=None):
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from util import hook
|
from util import hook
|
||||||
import random
|
import random
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def flip(inp, flip_count=0, say = None):
|
def flip(inp, flip_count=0, say=None):
|
||||||
".flip <text> -- Flips <text> over."
|
".flip <text> -- Flips <text> over."
|
||||||
guy = unicode(random.choice(flips), 'utf8')
|
guy = unicode(random.choice(flips), 'utf8')
|
||||||
inp = inp.lower()
|
inp = inp.lower()
|
||||||
|
|
|
@ -53,5 +53,3 @@ def flirt(inp, nick=None, me=None, input=None):
|
||||||
if inp == input.conn.nick.lower() or inp == "itself":
|
if inp == input.conn.nick.lower() or inp == "itself":
|
||||||
msg = "flirts with itself... \"" + random.choice(flirts) + "\""
|
msg = "flirts with itself... \"" + random.choice(flirts) + "\""
|
||||||
me(msg)
|
me(msg)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ base_url = 'http://www.fmylife.com/'
|
||||||
def fml(inp):
|
def fml(inp):
|
||||||
".fml [id] -- Gets a random quote from fmyfife.com. Optionally gets [id]."
|
".fml [id] -- Gets a random quote from fmyfife.com. Optionally gets [id]."
|
||||||
|
|
||||||
inp = inp.replace("#","") # this lets people use .fml #123456
|
inp = inp.replace("#", "")
|
||||||
|
|
||||||
if inp:
|
if inp:
|
||||||
if not inp.isdigit():
|
if not inp.isdigit():
|
||||||
|
|
|
@ -63,4 +63,3 @@ def fortune(inp, nick=None, say=None, input=None):
|
||||||
msg = "(@" + inp + ") " + random.choice(fortunes)
|
msg = "(@" + inp + ") " + random.choice(fortunes)
|
||||||
|
|
||||||
say(msg)
|
say(msg)
|
||||||
|
|
||||||
|
|
|
@ -15,21 +15,22 @@ def find_location(ip, api):
|
||||||
|
|
||||||
def timezone(ip):
|
def timezone(ip):
|
||||||
time = find_location(ip)["timezone"]
|
time = find_location(ip)["timezone"]
|
||||||
time = time.replace(":",".")
|
time = time.replace(":", ".")
|
||||||
time = time.replace(".00","")
|
time = time.replace(".00", "")
|
||||||
return int(time)
|
return int(time)
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
@hook.command("location")
|
@hook.command("location")
|
||||||
def geoip(inp, say = None, bot = None):
|
def geoip(inp, say=None, bot=None):
|
||||||
".geoip <ip> - Performs a location check on <ip>."
|
".geoip <ip> - Performs a location check on <ip>."
|
||||||
api_key = bot.config.get("api_keys", {}).get("geoip", None)
|
api_key = bot.config.get("api_keys", {}).get("geoip", None)
|
||||||
if api_key is None:
|
if api_key is None:
|
||||||
return "error: no api key set"
|
return "error: no api key set"
|
||||||
give = find_location(inp, api_key)
|
give = find_location(inp, api_key)
|
||||||
if give["country"] not in [""," ","-"," - "]:
|
if give["country"] not in ["", " ", "-", " - "]:
|
||||||
if give["state"] == give["city"]:
|
if give["state"] == give["city"]:
|
||||||
localstring = give["city"]
|
localstring = give["city"]
|
||||||
else:
|
else:
|
||||||
localstring = give["city"] + ", " + give["state"]
|
localstring = give["city"] + ", " + give["state"]
|
||||||
say("That IP comes from " + give["country"] + " (" + give["country_short"] + ")")
|
say("That IP comes from " + give["country"] + " (" + give["country_short"] + ")")
|
||||||
|
@ -37,4 +38,3 @@ def geoip(inp, say = None, bot = None):
|
||||||
else:
|
else:
|
||||||
say("Either that wasn't an IP or I cannot locate it in my database. :(")
|
say("Either that wasn't an IP or I cannot locate it in my database. :(")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,16 @@ def gitio(inp):
|
||||||
except:
|
except:
|
||||||
code = None
|
code = None
|
||||||
|
|
||||||
# if the first 8 chars of "url" are not "https://" then append "https://" to the url
|
# if the first 8 chars of "url" are not "https://" then append "https://" to the url, also convert "http://" to "https://"
|
||||||
if url[:8] != "https://":
|
if url[:8] != "https://":
|
||||||
url = "https://" + url
|
if url[:7] != "http://":
|
||||||
|
url = "https://" + url
|
||||||
|
else:
|
||||||
|
url = "https://" + url[7:]
|
||||||
url='url='+str(url)
|
url='url='+str(url)
|
||||||
if code:
|
if code:
|
||||||
url = url + '&code=' + str(code)
|
url = url + '&code=' + str(code)
|
||||||
req = urllib2.Request(url='http://git.io', data = url)
|
req = urllib2.Request(url='http://git.io', data=url)
|
||||||
|
|
||||||
# try getting url, catch http error
|
# try getting url, catch http error
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -19,7 +19,7 @@ def gis(inp):
|
||||||
parsed['responseStatus'], ''))
|
parsed['responseStatus'], ''))
|
||||||
if not parsed['responseData']['results']:
|
if not parsed['responseData']['results']:
|
||||||
return 'no images found'
|
return 'no images found'
|
||||||
return random.choice(parsed['responseData']['results'][:10]) \
|
return random.choice(parsed['responseData']['results'][:10])\
|
||||||
['unescapedUrl'] # squares is dumb
|
['unescapedUrl'] # squares is dumb
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,4 +31,3 @@ def clock(inp, say=None):
|
||||||
output = output.decode('utf-8', 'ignore')
|
output = output.decode('utf-8', 'ignore')
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
|
@ -24,7 +24,7 @@ def help(inp, input=None, bot=None, say=None, notice=None):
|
||||||
|
|
||||||
if not inp:
|
if not inp:
|
||||||
length = 0
|
length = 0
|
||||||
out = ["",""]
|
out = ["", ""]
|
||||||
well = []
|
well = []
|
||||||
for x in commands:
|
for x in commands:
|
||||||
well.append(x)
|
well.append(x)
|
||||||
|
|
|
@ -47,4 +47,3 @@ def insult(inp, nick=None, say=None, input=None):
|
||||||
msg = "*stares at " + nick + "*"
|
msg = "*stares at " + nick + "*"
|
||||||
|
|
||||||
say(msg)
|
say(msg)
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ body = ['head',
|
||||||
'"special parts"']
|
'"special parts"']
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def kill(inp, me = None, nick = None, input=None, notice=None):
|
def kill(inp, me=None, nick=None, input=None, notice=None):
|
||||||
".kill <user> -- Makes the bot kill <user>."
|
".kill <user> -- Makes the bot kill <user>."
|
||||||
inp = inp.strip()
|
inp = inp.strip()
|
||||||
|
|
||||||
|
@ -40,4 +40,3 @@ def kill(inp, me = None, nick = None, input=None, notice=None):
|
||||||
msg = re.sub ('<body>', random.choice(body), kill)
|
msg = re.sub ('<body>', random.choice(body), kill)
|
||||||
|
|
||||||
me(msg)
|
me(msg)
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ larts = ["swaps <who>'s shampoo with glue",
|
||||||
"hands <who> a poison ivy joint"]
|
"hands <who> a poison ivy joint"]
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def lart(inp, me = None, nick = None, input=None, notice=None):
|
def lart(inp, me=None, nick=None, input=None, notice=None):
|
||||||
".lart <user> -- Makes the bot LART <user>."
|
".lart <user> -- Makes the bot LART <user>."
|
||||||
inp = inp.strip()
|
inp = inp.strip()
|
||||||
|
|
||||||
|
@ -116,4 +116,3 @@ def lart(inp, me = None, nick = None, input=None, notice=None):
|
||||||
msg = re.sub ('<who>', inp, random.choice(larts))
|
msg = re.sub ('<who>', inp, random.choice(larts))
|
||||||
|
|
||||||
me(msg)
|
me(msg)
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,13 @@ def lastfm(inp, nick='', say=None, db=None, bot=None):
|
||||||
if not inp: user = sql[0]
|
if not inp: user = sql[0]
|
||||||
else:
|
else:
|
||||||
user = inp
|
user = inp
|
||||||
db.execute("insert or replace into lastfm(nick,acc) values(?,?)",(nick.lower(), user))
|
db.execute("insert or replace into lastfm(nick,acc) values(?,?)", (nick.lower(), user))
|
||||||
db.commit()
|
db.commit()
|
||||||
else:
|
else:
|
||||||
if not inp: user = nick
|
if not inp: user = nick
|
||||||
else:
|
else:
|
||||||
user = inp
|
user = inp
|
||||||
db.execute("insert or replace into lastfm(nick,acc) values(?,?)",(nick.lower(), user))
|
db.execute("insert or replace into lastfm(nick,acc) values(?,?)", (nick.lower(), user))
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
response = http.get_json(api_url, method="user.getrecenttracks",
|
response = http.get_json(api_url, method="user.getrecenttracks",
|
||||||
|
@ -67,4 +67,3 @@ def lastfm(inp, nick='', say=None, db=None, bot=None):
|
||||||
ret += " on \x02%s\x0f" % album
|
ret += " on \x02%s\x0f" % album
|
||||||
|
|
||||||
say(ret)
|
say(ret)
|
||||||
|
|
||||||
|
|
|
@ -36,4 +36,3 @@ def mcpaid(inp):
|
||||||
return "The account \'" + inp + "\' is a premium Minecraft account!"
|
return "The account \'" + inp + "\' is a premium Minecraft account!"
|
||||||
else:
|
else:
|
||||||
return "The account \'" + inp + "\' is not a premium Minecraft account!"
|
return "The account \'" + inp + "\' is not a premium Minecraft account!"
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,8 @@ from util import hook, http
|
||||||
socket.setdefaulttimeout(10)
|
socket.setdefaulttimeout(10)
|
||||||
|
|
||||||
# Auto-join on Invite (Configurable, defaults to True)
|
# Auto-join on Invite (Configurable, defaults to True)
|
||||||
|
|
||||||
|
|
||||||
@hook.event('INVITE')
|
@hook.event('INVITE')
|
||||||
def invite(paraml, conn=None):
|
def invite(paraml, conn=None):
|
||||||
invitejoin = conn.conf.get('invitejoin', True)
|
invitejoin = conn.conf.get('invitejoin', True)
|
||||||
|
@ -17,6 +19,8 @@ def invite(paraml, conn=None):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Rejoin on kick (Configuragble, defaults to False)
|
# Rejoin on kick (Configuragble, defaults to False)
|
||||||
|
|
||||||
|
|
||||||
@hook.event('KICK')
|
@hook.event('KICK')
|
||||||
def rejoin(paraml, conn=None):
|
def rejoin(paraml, conn=None):
|
||||||
autorejoin = conn.conf.get('autorejoin', False)
|
autorejoin = conn.conf.get('autorejoin', False)
|
||||||
|
@ -25,6 +29,8 @@ def rejoin(paraml, conn=None):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
# Identify to NickServ (or other service)
|
# Identify to NickServ (or other service)
|
||||||
|
|
||||||
|
|
||||||
@hook.event('004')
|
@hook.event('004')
|
||||||
def onjoin(paraml, conn=None, bot=None):
|
def onjoin(paraml, conn=None, bot=None):
|
||||||
nickserv_password = conn.conf.get('nickserv_password', '')
|
nickserv_password = conn.conf.get('nickserv_password', '')
|
||||||
|
@ -32,12 +38,12 @@ def onjoin(paraml, conn=None, bot=None):
|
||||||
nickserv_command = conn.conf.get('nickserv_command', 'IDENTIFY %s')
|
nickserv_command = conn.conf.get('nickserv_command', 'IDENTIFY %s')
|
||||||
if nickserv_password:
|
if nickserv_password:
|
||||||
if nickserv_password in bot.config['censored_strings']:
|
if nickserv_password in bot.config['censored_strings']:
|
||||||
bot.config['censored_strings'].remove(nickserv_password)
|
bot.config['censored_strings'].remove(nickserv_password)
|
||||||
conn.msg(nickserv_name, nickserv_command % nickserv_password)
|
conn.msg(nickserv_name, nickserv_command % nickserv_password)
|
||||||
bot.config['censored_strings'].append(nickserv_password)
|
bot.config['censored_strings'].append(nickserv_password)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
mode = conn.conf.get('mode')
|
|
||||||
# Set bot modes
|
# Set bot modes
|
||||||
|
mode = conn.conf.get('mode')
|
||||||
if mode:
|
if mode:
|
||||||
conn.cmd('MODE', [conn.nick, mode])
|
conn.cmd('MODE', [conn.nick, mode])
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@ from util import hook, molecular
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
@hook.command()
|
@hook.command()
|
||||||
def namegen(inp, say = None, nick = None, input=None, notice=None):
|
def namegen(inp, say=None, nick=None, input=None, notice=None):
|
||||||
".namegen [modules] -- Generates some names using the chosen modules. '.namegen list' will display a list of all modules."
|
".namegen [modules] -- Generates some names using the chosen modules. '.namegen list' will display a list of all modules."
|
||||||
|
|
||||||
gen = molecular.Molecule()
|
gen = molecular.Molecule()
|
||||||
|
|
||||||
all_modules = gen.list_modules() # get a list of available name files
|
all_modules = gen.list_modules() # get a list of available name files
|
||||||
|
|
||||||
# return a list of all available modules
|
# return a list of all available modules
|
||||||
if inp == "list":
|
if inp == "list":
|
||||||
|
@ -21,13 +21,13 @@ def namegen(inp, say = None, nick = None, input=None, notice=None):
|
||||||
|
|
||||||
modules = []
|
modules = []
|
||||||
|
|
||||||
selected_modules = inp.split(' ') # split the input into a list of modules
|
selected_modules = inp.split(' ') # split the input into a list of modules
|
||||||
|
|
||||||
for module in selected_modules: # loop over the "selected_modules" list, and load any valid modules
|
for module in selected_modules: # loop over the "selected_modules" list, and load any valid modules
|
||||||
if module in all_modules:
|
if module in all_modules:
|
||||||
gen.load(module.encode('ascii'))
|
gen.load(module.encode('ascii'))
|
||||||
|
|
||||||
if not gen.name(): # lets try making a name to see if any modules actually got loaded
|
if not gen.name(): # lets try making a name to see if any modules actually got loaded
|
||||||
return "No valid modules specified :("
|
return "No valid modules specified :("
|
||||||
|
|
||||||
# time to generate some names and put them in a list
|
# time to generate some names and put them in a list
|
||||||
|
|
|
@ -29,13 +29,13 @@ def gen_password(types):
|
||||||
needs_def = 1
|
needs_def = 1
|
||||||
#adds numbers
|
#adds numbers
|
||||||
if "numeric" in types or "numbers" in types:
|
if "numeric" in types or "numbers" in types:
|
||||||
for x in range(0,10):
|
for x in range(0, 10):
|
||||||
okay.append(str(x))
|
okay.append(str(x))
|
||||||
else:
|
else:
|
||||||
needs_def = 1
|
needs_def = 1
|
||||||
#adds symbols
|
#adds symbols
|
||||||
if "symbols" in types:
|
if "symbols" in types:
|
||||||
sym = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '[', ']', '{', '}', '\\', '|', ';', ':', "'", '.', '>', ',', '<', '/', '?', '`', '~','"']
|
sym = ['!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '=', '_', '+', '[', ']', '{', '}', '\\', '|', ';', ':', "'", '.', '>', ',', '<', '/', '?', '`', '~', '"']
|
||||||
for x in sym:
|
for x in sym:
|
||||||
okay.append(x)
|
okay.append(x)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -5,7 +5,7 @@ import random
|
||||||
potatoes = ['AC Belmont', 'AC Blue Pride', 'AC Brador', 'AC Chaleur', 'AC Domino', 'AC Dubuc', 'AC Glacier Chip', 'AC Maple Gold', 'AC Novachip', 'AC Peregrine Red', 'AC Ptarmigan', 'AC Red Island', 'AC Saguenor', 'AC Stampede Russet', 'AC Sunbury', 'Abeille', 'Abnaki', 'Acadia', 'Acadia Russet', 'Accent', 'Adirondack Blue', 'Adirondack Red', 'Adora', 'Agria', 'All Blue', 'All Red', 'Alpha', 'Alta Russet', 'Alturas Russet', 'Amandine', 'Amisk', 'Andover', 'Anoka', 'Anson', 'Aquilon', 'Arran Consul', 'Asterix', 'Atlantic', 'Austrian Crescent', 'Avalanche', 'Banana', 'Bannock Russet', 'Batoche', 'BeRus', 'Belle De Fonteney', 'Belleisle', 'Bintje', 'Blossom', 'Blue Christie', 'Blue Mac', 'Brigus', 'Brise du Nord', 'Butte', 'Butterfinger', 'Caesar', 'CalWhite', 'CalRed', 'Caribe', 'Carlingford', 'Carlton', 'Carola', 'Cascade', 'Castile', 'Centennial Russet', 'Century Russet', 'Charlotte', 'Cherie', 'Cherokee', 'Cherry Red', 'Chieftain', 'Chipeta', 'Coastal Russet', 'Colorado Rose', 'Concurrent', 'Conestoga', 'Cowhorn', 'Crestone Russet', 'Crispin', 'Cupids', 'Daisy Gold', 'Dakota Pearl', 'Defender', 'Delikat', 'Denali', 'Desiree', 'Divina', 'Dundrod', 'Durango Red', 'Early Rose', 'Elba', 'Envol', 'Epicure', 'Eramosa', 'Estima', 'Eva', 'Fabula', 'Fambo', 'Fremont Russet', 'French Fingerling', 'Frontier Russet', 'Fundy', 'Garnet Chile', 'Gem Russet', 'GemStar Russet', 'Gemchip', 'German Butterball', 'Gigant', 'Goldrush', 'Granola', 'Green Mountain', 'Haida', 'Hertha', 'Hilite Russet', 'Huckleberry', 'Hunter', 'Huron', 'IdaRose', 'Innovator', 'Irish Cobbler', 'Island Sunshine', 'Ivory Crisp', 'Jacqueline Lee', 'Jemseg', 'Kanona', 'Katahdin', 'Kennebec', "Kerr's Pink", 'Keswick', 'Keuka Gold', 'Keystone Russet', 'King Edward VII', 'Kipfel', 'Klamath Russet', 'Krantz', 'LaRatte', 'Lady Rosetta', 'Latona', 'Lemhi Russet', 'Liberator', 'Lili', 'MaineChip', 'Marfona', 'Maris Bard', 'Maris Piper', 'Matilda', 'Mazama', 'McIntyre', 'Michigan Purple', 'Millenium Russet', 'Mirton Pearl', 'Modoc', 'Mondial', 'Monona', 'Morene', 'Morning Gold', 'Mouraska', 'Navan', 'Nicola', 'Nipigon', 'Niska', 'Nooksack', 'NorValley', 'Norchip', 'Nordonna', 'Norgold Russet', 'Norking Russet', 'Norland', 'Norwis', 'Obelix', 'Ozette', 'Peanut', 'Penta', 'Peribonka', 'Peruvian Purple', 'Pike', 'Pink Pearl', 'Prospect', 'Pungo', 'Purple Majesty', 'Purple Viking', 'Ranger Russet', 'Reba', 'Red Cloud', 'Red Gold', 'Red La Soda', 'Red Pontiac', 'Red Ruby', 'Red Thumb', 'Redsen', 'Rocket', 'Rose Finn Apple', 'Rose Gold', 'Roselys', 'Rote Erstling', 'Ruby Crescent', 'Russet Burbank', 'Russet Legend', 'Russet Norkotah', 'Russet Nugget', 'Russian Banana', 'Saginaw Gold', 'Sangre', 'Sant<EFBFBD>', 'Satina', 'Saxon', 'Sebago', 'Shepody', 'Sierra', 'Silverton Russet', 'Simcoe', 'Snowden', 'Spunta', "St. John's", 'Summit Russet', 'Sunrise', 'Superior', 'Symfonia', 'Tolaas', 'Trent', 'True Blue', 'Ulla', 'Umatilla Russet', 'Valisa', 'Van Gogh', 'Viking', 'Wallowa Russet', 'Warba', 'Western Russet', 'White Rose', 'Willamette', 'Winema', 'Yellow Finn', 'Yukon Gold']
|
potatoes = ['AC Belmont', 'AC Blue Pride', 'AC Brador', 'AC Chaleur', 'AC Domino', 'AC Dubuc', 'AC Glacier Chip', 'AC Maple Gold', 'AC Novachip', 'AC Peregrine Red', 'AC Ptarmigan', 'AC Red Island', 'AC Saguenor', 'AC Stampede Russet', 'AC Sunbury', 'Abeille', 'Abnaki', 'Acadia', 'Acadia Russet', 'Accent', 'Adirondack Blue', 'Adirondack Red', 'Adora', 'Agria', 'All Blue', 'All Red', 'Alpha', 'Alta Russet', 'Alturas Russet', 'Amandine', 'Amisk', 'Andover', 'Anoka', 'Anson', 'Aquilon', 'Arran Consul', 'Asterix', 'Atlantic', 'Austrian Crescent', 'Avalanche', 'Banana', 'Bannock Russet', 'Batoche', 'BeRus', 'Belle De Fonteney', 'Belleisle', 'Bintje', 'Blossom', 'Blue Christie', 'Blue Mac', 'Brigus', 'Brise du Nord', 'Butte', 'Butterfinger', 'Caesar', 'CalWhite', 'CalRed', 'Caribe', 'Carlingford', 'Carlton', 'Carola', 'Cascade', 'Castile', 'Centennial Russet', 'Century Russet', 'Charlotte', 'Cherie', 'Cherokee', 'Cherry Red', 'Chieftain', 'Chipeta', 'Coastal Russet', 'Colorado Rose', 'Concurrent', 'Conestoga', 'Cowhorn', 'Crestone Russet', 'Crispin', 'Cupids', 'Daisy Gold', 'Dakota Pearl', 'Defender', 'Delikat', 'Denali', 'Desiree', 'Divina', 'Dundrod', 'Durango Red', 'Early Rose', 'Elba', 'Envol', 'Epicure', 'Eramosa', 'Estima', 'Eva', 'Fabula', 'Fambo', 'Fremont Russet', 'French Fingerling', 'Frontier Russet', 'Fundy', 'Garnet Chile', 'Gem Russet', 'GemStar Russet', 'Gemchip', 'German Butterball', 'Gigant', 'Goldrush', 'Granola', 'Green Mountain', 'Haida', 'Hertha', 'Hilite Russet', 'Huckleberry', 'Hunter', 'Huron', 'IdaRose', 'Innovator', 'Irish Cobbler', 'Island Sunshine', 'Ivory Crisp', 'Jacqueline Lee', 'Jemseg', 'Kanona', 'Katahdin', 'Kennebec', "Kerr's Pink", 'Keswick', 'Keuka Gold', 'Keystone Russet', 'King Edward VII', 'Kipfel', 'Klamath Russet', 'Krantz', 'LaRatte', 'Lady Rosetta', 'Latona', 'Lemhi Russet', 'Liberator', 'Lili', 'MaineChip', 'Marfona', 'Maris Bard', 'Maris Piper', 'Matilda', 'Mazama', 'McIntyre', 'Michigan Purple', 'Millenium Russet', 'Mirton Pearl', 'Modoc', 'Mondial', 'Monona', 'Morene', 'Morning Gold', 'Mouraska', 'Navan', 'Nicola', 'Nipigon', 'Niska', 'Nooksack', 'NorValley', 'Norchip', 'Nordonna', 'Norgold Russet', 'Norking Russet', 'Norland', 'Norwis', 'Obelix', 'Ozette', 'Peanut', 'Penta', 'Peribonka', 'Peruvian Purple', 'Pike', 'Pink Pearl', 'Prospect', 'Pungo', 'Purple Majesty', 'Purple Viking', 'Ranger Russet', 'Reba', 'Red Cloud', 'Red Gold', 'Red La Soda', 'Red Pontiac', 'Red Ruby', 'Red Thumb', 'Redsen', 'Rocket', 'Rose Finn Apple', 'Rose Gold', 'Roselys', 'Rote Erstling', 'Ruby Crescent', 'Russet Burbank', 'Russet Legend', 'Russet Norkotah', 'Russet Nugget', 'Russian Banana', 'Saginaw Gold', 'Sangre', 'Sant<EFBFBD>', 'Satina', 'Saxon', 'Sebago', 'Shepody', 'Sierra', 'Silverton Russet', 'Simcoe', 'Snowden', 'Spunta', "St. John's", 'Summit Russet', 'Sunrise', 'Superior', 'Symfonia', 'Tolaas', 'Trent', 'True Blue', 'Ulla', 'Umatilla Russet', 'Valisa', 'Van Gogh', 'Viking', 'Wallowa Russet', 'Warba', 'Western Russet', 'White Rose', 'Willamette', 'Winema', 'Yellow Finn', 'Yukon Gold']
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def potato(inp, me = None, input=None):
|
def potato(inp, me=None, input=None):
|
||||||
".potato <user> - Makes <user> a tasty little potato."
|
".potato <user> - Makes <user> a tasty little potato."
|
||||||
inp = inp.strip()
|
inp = inp.strip()
|
||||||
|
|
||||||
|
@ -18,4 +18,3 @@ def potato(inp, me = None, input=None):
|
||||||
method = random.choice(['bakes', 'fries', 'boils', 'microwaves'])
|
method = random.choice(['bakes', 'fries', 'boils', 'microwaves'])
|
||||||
|
|
||||||
me("%s a %s %s %s potato for %s!" % (method, flavor, size, potato_type, inp))
|
me("%s a %s %s %s potato for %s!" % (method, flavor, size, potato_type, inp))
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ def python(inp):
|
||||||
|
|
||||||
res = http.get("http://eval.appspot.com/eval", statement=inp).splitlines()
|
res = http.get("http://eval.appspot.com/eval", statement=inp).splitlines()
|
||||||
|
|
||||||
|
|
||||||
if len(res) == 0:
|
if len(res) == 0:
|
||||||
return
|
return
|
||||||
res[0] = re_lineends.split(res[0])[0]
|
res[0] = re_lineends.split(res[0])[0]
|
||||||
|
|
|
@ -46,17 +46,17 @@ def del_quote(db, chan, nick, add_nick, msg):
|
||||||
|
|
||||||
def get_quote_num(num, count, name):
|
def get_quote_num(num, count, name):
|
||||||
"Returns the quote number desired from the database"
|
"Returns the quote number desired from the database"
|
||||||
if num: # Make sure num is a number if it isn't false
|
if num: # Make sure num is a number if it isn't false
|
||||||
num = int(num)
|
num = int(num)
|
||||||
if count == 0: # If there are no quotes in the database, raise an Exception.
|
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.
|
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
|
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.
|
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
|
if num and num == 0: # If the number is zero, set it to one
|
||||||
num = 1
|
num = 1
|
||||||
if not num: # If a number is not given, select a random one
|
if not num: # If a number is not given, select a random one
|
||||||
num = random.randint(1, count)
|
num = random.randint(1, count)
|
||||||
return num
|
return num
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,6 @@ def repaste(inp, input=None, db=None, isManual=True):
|
||||||
if parts[0] == 'list':
|
if parts[0] == 'list':
|
||||||
return " ".join(pasters.keys())
|
return " ".join(pasters.keys())
|
||||||
|
|
||||||
|
|
||||||
paster = paste_gist
|
paster = paste_gist
|
||||||
args = {}
|
args = {}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ from urllib import urlencode
|
||||||
class ShortenError(Exception):
|
class ShortenError(Exception):
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr(self.value)
|
return repr(self.value)
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ def bitly(url, user, apikey):
|
||||||
return "Could not shorten %s!" % url
|
return "Could not shorten %s!" % url
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def shorten(inp, bot = None):
|
def shorten(inp, bot=None):
|
||||||
".shorten <url> - Makes an j.mp/bit.ly shortlink to the url provided."
|
".shorten <url> - Makes an j.mp/bit.ly shortlink to the url provided."
|
||||||
api_user = bot.config.get("api_keys", {}).get("bitly_user", None)
|
api_user = bot.config.get("api_keys", {}).get("bitly_user", None)
|
||||||
api_key = bot.config.get("api_keys", {}).get("bitly_api", None)
|
api_key = bot.config.get("api_keys", {}).get("bitly_api", None)
|
||||||
|
@ -32,7 +33,7 @@ def shorten(inp, bot = None):
|
||||||
return bitly(inp, api_user, api_key)
|
return bitly(inp, api_user, api_key)
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def expand(inp, bot = None):
|
def expand(inp, bot=None):
|
||||||
".expand <url> - Gets the original URL from a shortened link."
|
".expand <url> - Gets the original URL from a shortened link."
|
||||||
try:
|
try:
|
||||||
url = http.get_url(inp)
|
url = http.get_url(inp)
|
||||||
|
|
|
@ -30,7 +30,7 @@ items = ["cast iron skillet",
|
||||||
"chunk of dirt"]
|
"chunk of dirt"]
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def slap(inp, me = None, nick = None, input=None, notice=None):
|
def slap(inp, me=None, nick=None, input=None, notice=None):
|
||||||
".slap <user> -- Makes the bot slap <user>."
|
".slap <user> -- Makes the bot slap <user>."
|
||||||
inp = inp.strip()
|
inp = inp.strip()
|
||||||
|
|
||||||
|
@ -48,4 +48,3 @@ def slap(inp, me = None, nick = None, input=None, notice=None):
|
||||||
msg = re.sub ('<item>', random.choice(items), slap)
|
msg = re.sub ('<item>', random.choice(items), slap)
|
||||||
|
|
||||||
me(msg)
|
me(msg)
|
||||||
|
|
||||||
|
|
|
@ -20,4 +20,3 @@ def spell(inp):
|
||||||
return "That word appears to be valid! (suggestions: " + s_string + ")"
|
return "That word appears to be valid! (suggestions: " + s_string + ")"
|
||||||
else:
|
else:
|
||||||
return "That word appears to be invalid! (suggestions: " + s_string + ")"
|
return "That word appears to be invalid! (suggestions: " + s_string + ")"
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ def tellinput(paraml, input=None, db=None, bot=None):
|
||||||
|
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
|
||||||
|
|
||||||
tells = get_tells(db, input.nick)
|
tells = get_tells(db, input.nick)
|
||||||
|
|
||||||
if tells:
|
if tells:
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
# MyGengo translation plugin by lukeroge and neersighted
|
# MyGengo translation plugin by lukeroge and neersighted
|
||||||
from util import hook, http
|
from util import hook
|
||||||
import re, htmlentitydefs
|
from util import http
|
||||||
|
import re
|
||||||
|
import htmlentitydefs
|
||||||
import mygengo
|
import mygengo
|
||||||
|
|
||||||
gengo = mygengo.MyGengo(
|
gengo = mygengo.MyGengo(
|
||||||
public_key = 'PlwtF1CZ2tu27IdX_SXNxTFmfN0j|_-pJ^Rf({O-oLl--r^QM4FygRdt^jusSSDE',
|
public_key='PlwtF1CZ2tu27IdX_SXNxTFmfN0j|_-pJ^Rf({O-oLl--r^QM4FygRdt^jusSSDE',
|
||||||
private_key = 'wlXpL=SU[#JpPu[dQaf$v{S3@rg[=95$$TA(k$sb3_6~B_zDKkTbd4#hXxaorIae',
|
private_key='wlXpL=SU[#JpPu[dQaf$v{S3@rg[=95$$TA(k$sb3_6~B_zDKkTbd4#hXxaorIae',
|
||||||
sandbox = False,
|
sandbox=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
def gengo_translate(text, source, target):
|
def gengo_translate(text, source, target):
|
||||||
try:
|
try:
|
||||||
translation = gengo.postTranslationJob(job = {
|
translation = gengo.postTranslationJob(job={
|
||||||
'type': 'text',
|
'type': 'text',
|
||||||
'slug': 'Translating '+source+' to '+target+' with the myGengo API',
|
'slug': 'Translating '+source+' to '+target+' with the myGengo API',
|
||||||
'body_src': text,
|
'body_src': text,
|
||||||
|
@ -111,4 +113,3 @@ lang_pairs = [
|
||||||
("cy", "Welsh"),
|
("cy", "Welsh"),
|
||||||
("yi", "Yiddish")
|
("yi", "Yiddish")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ def get_episode_info(episode, api_key):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
@hook.command('tv')
|
@hook.command('tv')
|
||||||
def tv_next(inp, bot = None):
|
def tv_next(inp, bot=None):
|
||||||
".tv <series> -- Get the next episode of <series>."
|
".tv <series> -- Get the next episode of <series>."
|
||||||
|
|
||||||
api_key = bot.config.get("api_keys", {}).get("tvdb", None)
|
api_key = bot.config.get("api_keys", {}).get("tvdb", None)
|
||||||
|
@ -134,7 +134,7 @@ def tv_next(inp, bot = None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
@hook.command('tv_prev')
|
@hook.command('tv_prev')
|
||||||
def tv_last(inp, bot = None):
|
def tv_last(inp, bot=None):
|
||||||
".tv_last <series> -- Gets the most recently aired episode of <series>."
|
".tv_last <series> -- Gets the most recently aired episode of <series>."
|
||||||
|
|
||||||
api_key = bot.config.get("api_keys", {}).get("tvdb", None)
|
api_key = bot.config.get("api_keys", {}).get("tvdb", None)
|
||||||
|
|
|
@ -26,28 +26,28 @@ history = []
|
||||||
history_max_size = 250
|
history_max_size = 250
|
||||||
|
|
||||||
def parseDateTime(s):
|
def parseDateTime(s):
|
||||||
if s is None:
|
if s is None:
|
||||||
return None
|
return None
|
||||||
m = re.match(r'(.*?)(?:\.(\d+))?(([-+]\d{1,2}):(\d{2}))?$',
|
m = re.match(r'(.*?)(?:\.(\d+))?(([-+]\d{1,2}):(\d{2}))?$',
|
||||||
str(s))
|
str(s))
|
||||||
datestr, fractional, tzname, tzhour, tzmin = m.groups()
|
datestr, fractional, tzname, tzhour, tzmin = m.groups()
|
||||||
|
|
||||||
if tzname is None:
|
if tzname is None:
|
||||||
tz = None
|
tz = None
|
||||||
else:
|
else:
|
||||||
tzhour, tzmin = int(tzhour), int(tzmin)
|
tzhour, tzmin = int(tzhour), int(tzmin)
|
||||||
if tzhour == tzmin == 0:
|
if tzhour == tzmin == 0:
|
||||||
tzname = 'UTC'
|
tzname = 'UTC'
|
||||||
tz = FixedOffset(timedelta(hours=tzhour,
|
tz = FixedOffset(timedelta(hours=tzhour,
|
||||||
minutes=tzmin), tzname)
|
minutes=tzmin), tzname)
|
||||||
|
|
||||||
x = datetime.strptime(datestr, "%Y-%m-%d %H:%M:%S")
|
x = datetime.strptime(datestr, "%Y-%m-%d %H:%M:%S")
|
||||||
if fractional is None:
|
if fractional is None:
|
||||||
fractional = '0'
|
fractional = '0'
|
||||||
fracpower = 6 - len(fractional)
|
fracpower = 6 - len(fractional)
|
||||||
fractional = float(fractional) * (10 ** fracpower)
|
fractional = float(fractional) * (10 ** fracpower)
|
||||||
|
|
||||||
return x.replace(microsecond=int(fractional), tzinfo=tz)
|
return x.replace(microsecond=int(fractional), tzinfo=tz)
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
|
|
Reference in a new issue