overhauled help
This commit is contained in:
parent
0fdf370733
commit
c58192f72c
58 changed files with 124 additions and 117 deletions
|
@ -12,8 +12,8 @@ answers = [g + "As I see it, yes",
|
||||||
g + "Most likely",
|
g + "Most likely",
|
||||||
g + "Outlook good",
|
g + "Outlook good",
|
||||||
g + "Signs point to yes",
|
g + "Signs point to yes",
|
||||||
g + "One would be wise to think so",#
|
g + "One would be wise to think so",
|
||||||
g + "Naturally",#
|
g + "Naturally",
|
||||||
g + "Without a doubt",
|
g + "Without a doubt",
|
||||||
g + "Yes",
|
g + "Yes",
|
||||||
g + "Yes, definitely",
|
g + "Yes, definitely",
|
||||||
|
@ -23,11 +23,11 @@ answers = [g + "As I see it, yes",
|
||||||
y + "Better not tell you now",
|
y + "Better not tell you now",
|
||||||
y + "Cannot predict now",
|
y + "Cannot predict now",
|
||||||
y + "Concentrate and ask again",
|
y + "Concentrate and ask again",
|
||||||
y + "You know the answer better than I",#
|
y + "You know the answer better than I",
|
||||||
y + "Maybe...",#
|
y + "Maybe...",
|
||||||
r + "You're kidding, right?",#
|
r + "You're kidding, right?",
|
||||||
r + "Don't count on it",
|
r + "Don't count on it",
|
||||||
r + "In your dreams", #
|
r + "In your dreams",
|
||||||
r + "My reply is no",
|
r + "My reply is no",
|
||||||
r + "My sources say no",
|
r + "My sources say no",
|
||||||
r + "Outlook not so good",
|
r + "Outlook not so good",
|
||||||
|
@ -35,7 +35,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, in electronic form. Ask a question and the answer shall be provided."
|
".8ball <question> -- The all knowing magic eight ball, in electronic form. Ask and it shall be answered!"
|
||||||
global nextresponsenumber
|
global nextresponsenumber
|
||||||
inp = inp.strip()
|
inp = inp.strip()
|
||||||
if re.match("[a-zA-Z0-9]", inp[-1]):
|
if re.match("[a-zA-Z0-9]", inp[-1]):
|
||||||
|
|
|
@ -16,7 +16,7 @@ def isadmin(input):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def quit(inp, input=None, db=None, notice=None):
|
def quit(inp, input=None, db=None, notice=None):
|
||||||
".quit [reason] -- kills the bot"
|
".quit [reason] -- Kills the bot, with [reason] reason as its quit message.."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -30,7 +30,7 @@ def quit(inp, input=None, db=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def join(inp, input=None, db=None, notice=None):
|
def join(inp, input=None, db=None, notice=None):
|
||||||
".join <channel> -- joins a channel"
|
".join <channel> -- Joins <channel>."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -40,7 +40,7 @@ def join(inp, input=None, db=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def cycle(inp, input=None, db=None, notice=None):
|
def cycle(inp, input=None, db=None, notice=None):
|
||||||
".cycle <channel> -- cycles a channel"
|
".cycle <channel> -- Cycles <channel>."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -50,7 +50,7 @@ def cycle(inp, input=None, db=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def part(inp, input=None, notice=None):
|
def part(inp, input=None, notice=None):
|
||||||
".part <channel> -- leaves a channel"
|
".part <channel> -- Parts from <channel>."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -59,7 +59,7 @@ def part(inp, input=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def nick(inp, input=None, notice=None):
|
def nick(inp, input=None, notice=None):
|
||||||
".nick <nick> -- change the bots nickname to <nick>"
|
".nick <nick> -- Changes the bots nickname to <nick>."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -68,7 +68,7 @@ def nick(inp, input=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def raw(inp, input=None, notice=None):
|
def raw(inp, input=None, notice=None):
|
||||||
".raw <command> - Send a RAW IRC command!"
|
".raw <command> -- Sends a RAW IRC command."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -77,7 +77,7 @@ def raw(inp, input=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def kick(inp, input=None, notice=None):
|
def kick(inp, input=None, notice=None):
|
||||||
".kick [channel] <user> [reason] -- kick a user!"
|
".kick [channel] <user> [reason] -- kicks a user."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -108,7 +108,7 @@ def kick(inp, input=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def say(inp, input=None, notice=None):
|
def say(inp, input=None, notice=None):
|
||||||
".say [channel] <message> -- makes the bot say <message> in [channel]. if [channel] is blank the bot will say the <message> in the channel the command was used in."
|
".say [channel] <message> -- Makes the bot say <message> in [channel]. If [channel] is blank the bot will say the <message> in the channel the command was used in."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -130,7 +130,7 @@ def say(inp, input=None, notice=None):
|
||||||
@hook.command("me")
|
@hook.command("me")
|
||||||
@hook.command
|
@hook.command
|
||||||
def act(inp, input=None, notice=None):
|
def act(inp, input=None, notice=None):
|
||||||
".act [channel] <action> -- makes the bot act <action> in [channel]. if [channel] is blank the bot will act the <action> in the channel the command was used in."
|
".act [channel] <action> -- Makes the bot act out <action> in [channel]. Ff [channel] is blank the bot will act the <action> in the channel the command was used in."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -151,7 +151,7 @@ def act(inp, input=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def topic(inp, input=None, notice=None):
|
def topic(inp, input=None, notice=None):
|
||||||
".topic [channel] <topic> -- change the topic of a channel"
|
".topic [channel] <topic> -- Change the topic of a channel."
|
||||||
if not isadmin(input):
|
if not isadmin(input):
|
||||||
notice("Only bot admins can use this command!")
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
@ -177,7 +177,7 @@ def mutesieve(bot, input, func, kind, args):
|
||||||
def mute(inp, input=None, db=None, bot=None, users=None):
|
def mute(inp, input=None, db=None, bot=None, users=None):
|
||||||
if inp and inp in input.conn.users.channels.keys():
|
if inp and inp in input.conn.users.channels.keys():
|
||||||
input.chan = inp
|
input.chan = inp
|
||||||
".mute <channel> -- Mutes the bot"
|
".mute <channel> -- Mutes the bot in <channel>. If no channel is specified, it is muted in the current channel."
|
||||||
if usertracking.query(db, bot.config, input.nick, input.chan, "mute") or "o" in users[input.chan].usermodes[input.nick]:
|
if usertracking.query(db, bot.config, input.nick, input.chan, "mute") or "o" in users[input.chan].usermodes[input.nick]:
|
||||||
users[input.chan].mute = "%s %d" % (input.nick, time.time())
|
users[input.chan].mute = "%s %d" % (input.nick, time.time())
|
||||||
input.notice("Muted")
|
input.notice("Muted")
|
||||||
|
@ -188,7 +188,7 @@ def mute(inp, input=None, db=None, bot=None, users=None):
|
||||||
def unmute(inp, input=None, db=None, bot=None, users=None):
|
def unmute(inp, input=None, db=None, bot=None, users=None):
|
||||||
if inp and inp in users.channels.keys():
|
if inp and inp in users.channels.keys():
|
||||||
input.chan = inp
|
input.chan = inp
|
||||||
".unmute <channel> -- Unmutes the bot"
|
".unmute <channel> -- Unmutes the bot in <channel>. If no channel is specified, it is unmuted in the current channel."
|
||||||
if usertracking.query(db, bot.config, input.nick, input.chan, "mute") or "o" in users[input.chan].usermodes[input.nick]:
|
if usertracking.query(db, bot.config, input.nick, input.chan, "mute") or "o" in users[input.chan].usermodes[input.nick]:
|
||||||
if hasattr(users[input.chan], "mute"):
|
if hasattr(users[input.chan], "mute"):
|
||||||
input.notice("Unmuted")
|
input.notice("Unmuted")
|
||||||
|
|
|
@ -13,7 +13,7 @@ MAX_STEPS = 1000000
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def bf(inp):
|
def bf(inp):
|
||||||
".bf <prog> -- executes brainfuck program <prog>"""
|
".bf <prog> -- Executes <prog> as Brainfuck code."
|
||||||
|
|
||||||
program = re.sub('[^][<>+-.,]', '', inp)
|
program = re.sub('[^][<>+-.,]', '', inp)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ from util import http, hook
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def bitcoin(inp, say=None):
|
def bitcoin(inp, say=None):
|
||||||
".bitcoin -- gets current exchange rate for bitcoins from mtgox"
|
".bitcoin -- Gets current exchange rate for bitcoins from mtgox."
|
||||||
data = http.get_json("https://mtgox.com/code/data/ticker.php")
|
data = http.get_json("https://mtgox.com/code/data/ticker.php")
|
||||||
ticker = data['ticker']
|
ticker = data['ticker']
|
||||||
say("Current: \x0307$%(buy).2f\x0f - High: \x0307$%(high).2f\x0f"
|
say("Current: \x0307$%(buy).2f\x0f - High: \x0307$%(high).2f\x0f"
|
||||||
|
|
|
@ -83,7 +83,7 @@ def valueadd(bot, input, func, kind, args):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def mode(inp, input=None, db=None):
|
def mode(inp, input=None, db=None):
|
||||||
".mode -- Set modes on various things"
|
".mode -- Set modes on various things."
|
||||||
if input.nick not in input.bot.config["admins"]:
|
if input.nick not in input.bot.config["admins"]:
|
||||||
input.notice("Only bot admins can use this command!")
|
input.notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
|
|
@ -6,7 +6,7 @@ from util import hook
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def choose(inp):
|
def choose(inp):
|
||||||
".choose <choice1>, <choice2>, ... <choicen> -- makes a decision"
|
".choose <choice1>, [choice2], [choice3], [choice4], ... -- Randomly picks one of the given choices."
|
||||||
|
|
||||||
c = re.findall(r'([^,]+)', inp)
|
c = re.findall(r'([^,]+)', inp)
|
||||||
if len(c) == 1:
|
if len(c) == 1:
|
||||||
|
|
|
@ -17,7 +17,7 @@ def flip_simple(count):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def coin(inp):
|
def coin(inp):
|
||||||
".coin [amount] -- flips some coins and shares the result."
|
".coin [amount] -- Flips [amount] of coins."
|
||||||
|
|
||||||
# checking for valid input. if valid input [count=inp], if invalid [return error], if no input [count=1]
|
# checking for valid input. if valid input [count=inp], if invalid [return error], if no input [count=1]
|
||||||
if inp.isdigit():
|
if inp.isdigit():
|
||||||
|
|
|
@ -12,7 +12,7 @@ len_chars = len(chars)
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def cypher(inp):
|
def cypher(inp):
|
||||||
".cypher <pass> <string> -- cyphers a string with the password"
|
".cypher <pass> <string> -- Cyphers <string> with <password>."
|
||||||
|
|
||||||
passwd = inp.split(" ")[0]
|
passwd = inp.split(" ")[0]
|
||||||
len_passwd = len(passwd)
|
len_passwd = len(passwd)
|
||||||
|
@ -39,7 +39,7 @@ def cypher(inp):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def decypher(inp):
|
def decypher(inp):
|
||||||
".decypher <pass> <string> -- decyphers a string with the password"
|
".decypher <pass> <string> -- Decyphers <string> with <password>."
|
||||||
|
|
||||||
passwd = inp.split(" ")[0]
|
passwd = inp.split(" ")[0]
|
||||||
len_passwd = len(passwd)
|
len_passwd = len(passwd)
|
||||||
|
|
|
@ -36,7 +36,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, e.g. .dice 2d20-d5+4 roll 2 " \
|
".dice <diceroll> -- Simulates dicerolls. Example of <diceroll>: '.dice 2d20-d5+4 roll 2'." \
|
||||||
"D20s, subtract 1D5, add 4"
|
"D20s, subtract 1D5, add 4"
|
||||||
|
|
||||||
try: # if inp is a re.match object...
|
try: # if inp is a re.match object...
|
||||||
|
|
|
@ -6,7 +6,7 @@ from util import hook, http
|
||||||
@hook.command('u')
|
@hook.command('u')
|
||||||
@hook.command
|
@hook.command
|
||||||
def urban(inp):
|
def urban(inp):
|
||||||
'''.u/.urban <phrase> -- looks up <phrase> on urbandictionary.com'''
|
".urban <phrase> -- Looks up <phrase> on urbandictionary.com."
|
||||||
|
|
||||||
url = 'http://www.urbandictionary.com/iphone/search/define'
|
url = 'http://www.urbandictionary.com/iphone/search/define'
|
||||||
page = http.get_json(url, term=inp)
|
page = http.get_json(url, term=inp)
|
||||||
|
@ -26,7 +26,7 @@ def urban(inp):
|
||||||
@hook.command('dictionary')
|
@hook.command('dictionary')
|
||||||
@hook.command
|
@hook.command
|
||||||
def define(inp):
|
def define(inp):
|
||||||
".define/.dictionary <word> -- fetches definition of <word>"
|
".define <word> -- Fetches definition of <word>."
|
||||||
|
|
||||||
url = 'http://ninjawords.com/'
|
url = 'http://ninjawords.com/'
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ def define(inp):
|
||||||
@hook.command('e')
|
@hook.command('e')
|
||||||
@hook.command
|
@hook.command
|
||||||
def etymology(inp):
|
def etymology(inp):
|
||||||
".e/.etymology <word> -- Retrieves the etymology of chosen word"
|
".etymology <word> -- Retrieves the etymology of <word>."
|
||||||
|
|
||||||
url = 'http://www.etymonline.com/index.php'
|
url = 'http://www.etymonline.com/index.php'
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from util import hook, http
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def down(inp):
|
def down(inp):
|
||||||
'''.down <url> -- checks to see if the site is down'''
|
".down <url> -- Checks if the site at <url> is up or down."
|
||||||
|
|
||||||
if 'http://' not in inp:
|
if 'http://' not in inp:
|
||||||
inp = 'http://' + inp
|
inp = 'http://' + inp
|
||||||
|
|
|
@ -7,7 +7,7 @@ ed_url = "http://encyclopediadramatica.ch/"
|
||||||
@hook.command('ed')
|
@hook.command('ed')
|
||||||
@hook.command
|
@hook.command
|
||||||
def drama(inp):
|
def drama(inp):
|
||||||
".drama <phrase> -- gets first paragraph of Encyclopedia Dramatica article on <phrase>"
|
".drama <phrase> -- Gets the first paragraph of Encyclopedia Dramatica article on <phrase>."
|
||||||
|
|
||||||
j = http.get_json(api_url, search=inp)
|
j = http.get_json(api_url, search=inp)
|
||||||
if not j[1]:
|
if not j[1]:
|
||||||
|
|
|
@ -4,7 +4,7 @@ from BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def fact(inp, say=False, nick=False):
|
def fact(inp, say=False, nick=False):
|
||||||
".fact -- gets a fact from OMGFACTS"
|
".fact -- Gets a random fact from OMGFACTS."
|
||||||
|
|
||||||
fact = None
|
fact = None
|
||||||
while fact is None:
|
while fact is None:
|
||||||
|
|
|
@ -44,8 +44,9 @@ def multiwordReplace(text, wordDic):
|
||||||
|
|
||||||
@hook.command("r")
|
@hook.command("r")
|
||||||
def remember(inp, nick='', db=None, say=None, input=None, notice=None):
|
def remember(inp, nick='', db=None, say=None, input=None, notice=None):
|
||||||
".r <word> [+]<data> -- maps word to data in the memory"
|
".remember <word> [+]<data> -- Remembers <data> with <word>. Add + to <data> to append."
|
||||||
if input.nick not in input.bot.config["admins"]:
|
if input.nick not in input.bot.config["admins"]:
|
||||||
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
|
||||||
|
@ -88,8 +89,9 @@ def remember(inp, nick='', db=None, say=None, input=None, notice=None):
|
||||||
|
|
||||||
@hook.command("f")
|
@hook.command("f")
|
||||||
def forget(inp, db=None, input=None, notice=None):
|
def forget(inp, db=None, input=None, notice=None):
|
||||||
".f <word> -- forgets the mapping that word had"
|
".forget <word> -- Forgets a remembered <word>."
|
||||||
if input.nick not in input.bot.config["admins"]:
|
if input.nick not in input.bot.config["admins"]:
|
||||||
|
notice("Only bot admins can use this command!")
|
||||||
return
|
return
|
||||||
|
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
@ -108,7 +110,7 @@ def forget(inp, db=None, input=None, notice=None):
|
||||||
@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):
|
||||||
"?<word> -- shows what data is associated with word"
|
"?<word> -- Shows what data is associated with <word>."
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
|
||||||
data = get_memory(db, inp.group(1).strip())
|
data = get_memory(db, inp.group(1).strip())
|
||||||
|
|
|
@ -5,7 +5,7 @@ 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 the given text"
|
".flip <text> -- Flips <text> over."
|
||||||
guy = unicode(random.choice(flips), 'utf8')
|
guy = unicode(random.choice(flips), 'utf8')
|
||||||
inp = inp.lower()
|
inp = inp.lower()
|
||||||
inp = inp[::-1]
|
inp = inp[::-1]
|
||||||
|
|
|
@ -45,14 +45,14 @@ flirts = ["I bet your name's Mickey, 'cause you're so fine.",
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def flirt(inp, nick=None, me=None, input=None):
|
def flirt(inp, nick=None, me=None, input=None):
|
||||||
".flirt -- make mau5bot flirt!"
|
".flirt <user> -- Make the bot flirt with <user>."
|
||||||
|
|
||||||
msg = "flirts with " + nick + "... \"" + random.choice(flirts) + "\""
|
msg = "flirts with " + nick + "... \"" + random.choice(flirts) + "\""
|
||||||
if re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()) and inp != "":
|
if re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()) and inp != "":
|
||||||
msg = "flirts with " + inp + "... \"" + random.choice(flirts) + "\""
|
msg = "flirts with " + inp + "... \"" + random.choice(flirts) + "\""
|
||||||
|
|
||||||
if inp == input.conn.nick.lower() or inp == "itself":
|
if inp == input.conn.nick.lower() or inp == "itself":
|
||||||
msg = "flirts with itself"
|
msg = "flirts with itself!"
|
||||||
|
|
||||||
me(msg)
|
me(msg)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ base_url = 'http://www.fmylife.com/'
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def fml(inp):
|
def fml(inp):
|
||||||
".fml [id] -- gets a random quote from fmyfife.com"
|
".fml [id] -- Gets a random quote from fmyfife.com. Optionally gets [id]."
|
||||||
|
|
||||||
inp = inp.replace("#","") # this lets people use .fml #123456
|
inp = inp.replace("#","") # this lets people use .fml #123456
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ fortunes = ["Help! I'm stuck in the fortune cookie factory!",
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def fortune(inp, nick=None, say=None, input=None):
|
def fortune(inp, nick=None, say=None, input=None):
|
||||||
".fortune -- get your fortune"
|
".fortune -- Fortune cookies on demand."
|
||||||
|
|
||||||
msg = "(" + nick + ") " + random.choice(fortunes)
|
msg = "(" + nick + ") " + random.choice(fortunes)
|
||||||
if re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()) and inp != "":
|
if re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()) and inp != "":
|
||||||
|
|
|
@ -6,7 +6,7 @@ from BeautifulSoup import BeautifulSoup
|
||||||
@hook.command("calc")
|
@hook.command("calc")
|
||||||
@hook.command("math")
|
@hook.command("math")
|
||||||
def calc(inp):
|
def calc(inp):
|
||||||
'''.calc <term> -- returns Google Calculator result'''
|
".calc <term> -- Calculate <term> with Google Calc."
|
||||||
|
|
||||||
white_re = re.compile(r'\s+')
|
white_re = re.compile(r'\s+')
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ def timezone(ip):
|
||||||
@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 the ip given."
|
".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"
|
||||||
|
|
|
@ -11,7 +11,7 @@ def api_get(kind, query):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def gis(inp):
|
def gis(inp):
|
||||||
'''.gis <term> -- returns first google image result (safesearch off)'''
|
".gis <term> -- Returns first Google Image result (Safesearch off)."
|
||||||
|
|
||||||
parsed = api_get('images', inp)
|
parsed = api_get('images', inp)
|
||||||
if not 200 <= parsed['responseStatus'] < 300:
|
if not 200 <= parsed['responseStatus'] < 300:
|
||||||
|
@ -26,7 +26,7 @@ def gis(inp):
|
||||||
@hook.command('g')
|
@hook.command('g')
|
||||||
@hook.command
|
@hook.command
|
||||||
def google(inp):
|
def google(inp):
|
||||||
'''.g/.google <query> -- returns first google search result'''
|
".google <query> -- Returns first google search result for <query>."
|
||||||
|
|
||||||
parsed = api_get('web', inp)
|
parsed = api_get('web', inp)
|
||||||
if not 200 <= parsed['responseStatus'] < 300:
|
if not 200 <= parsed['responseStatus'] < 300:
|
||||||
|
|
|
@ -6,7 +6,7 @@ from BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
@hook.command("time")
|
@hook.command("time")
|
||||||
def clock(inp, say=None):
|
def clock(inp, say=None):
|
||||||
'''.time <area> -- gets the time in <area>'''
|
".time <area> -- Gets the time in <area>"
|
||||||
|
|
||||||
white_re = re.compile(r'\s+')
|
white_re = re.compile(r'\s+')
|
||||||
tags_re = re.compile(r'<[^<]*?>')
|
tags_re = re.compile(r'<[^<]*?>')
|
||||||
|
|
|
@ -3,26 +3,26 @@ from util import hook
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def md5(inp):
|
def md5(inp):
|
||||||
".hash <text> -- returns a md5 hash of <text>"
|
".hash <text> -- Returns a md5 hash of <text>."
|
||||||
return hashlib.md5(inp).hexdigest()
|
return hashlib.md5(inp).hexdigest()
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def sha1(inp):
|
def sha1(inp):
|
||||||
".hash <text> -- returns a sha1 hash of <text>"
|
".hash <text> -- Returns a sha1 hash of <text>."
|
||||||
return hashlib.sha1(inp).hexdigest()
|
return hashlib.sha1(inp).hexdigest()
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def sha256(inp):
|
def sha256(inp):
|
||||||
".hash <text> -- returns a sha256 hash of <text>"
|
".hash <text> -- Returns a sha256 hash of <text>."
|
||||||
return hashlib.sha256(inp).hexdigest()
|
return hashlib.sha256(inp).hexdigest()
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def sha512(inp):
|
def sha512(inp):
|
||||||
".hash <text> -- returns a sha512 hash of <text>"
|
".hash <text> -- Returns a sha512 hash of <text>."
|
||||||
return hashlib.sha512(inp).hexdigest()
|
return hashlib.sha512(inp).hexdigest()
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def hash(inp):
|
def hash(inp):
|
||||||
".hash <text> -- returns hashes of <text>"
|
".hash <text> -- Returns hashes of <text>."
|
||||||
return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest()
|
return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest()
|
||||||
for x in 'md5 sha1 sha256'.split())
|
for x in 'md5 sha1 sha256'.split())
|
||||||
|
|
|
@ -4,7 +4,7 @@ from util import hook
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def help(inp, input=None, bot=None, say=None, notice=None):
|
def help(inp, input=None, bot=None, say=None, notice=None):
|
||||||
".help -- gives a list of commands/help for a command"
|
".help -- Gives a list of commands/help for a command."
|
||||||
|
|
||||||
funcs = {}
|
funcs = {}
|
||||||
disabled = bot.config.get('disabled_plugins', [])
|
disabled = bot.config.get('disabled_plugins', [])
|
||||||
|
@ -38,7 +38,7 @@ def help(inp, input=None, bot=None, say=None, notice=None):
|
||||||
notice("Commands I recognise: " + out[0][1:])
|
notice("Commands I recognise: " + out[0][1:])
|
||||||
if out[1]:
|
if out[1]:
|
||||||
notice(out[1][1:])
|
notice(out[1][1:])
|
||||||
notice("For help, do '.help example' where example is the " +
|
notice("For detailed help, do '.help <example>' where <example> is the " +
|
||||||
"name of the command you want help for.")
|
"name of the command you want help for.")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -5,7 +5,7 @@ from util import hook, http
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def imdb(inp):
|
def imdb(inp):
|
||||||
'''.imdb <movie> -- gets information about <movie> from IMDb'''
|
".imdb <movie> -- Gets information about <movie> from IMDb."
|
||||||
|
|
||||||
content = http.get_json("http://www.imdbapi.com/", t=inp)
|
content = http.get_json("http://www.imdbapi.com/", t=inp)
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ insults = ["You are the son of a motherless ogre.",
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def insult(inp, nick=None, say=None, input=None):
|
def insult(inp, nick=None, say=None, input=None):
|
||||||
".insult [user] -- insult someone!"
|
".insult <user> -- Makes the bot insult <user>."
|
||||||
|
|
||||||
msg = "(" + nick + ") " + random.choice(insults)
|
msg = "(" + nick + ") " + random.choice(insults)
|
||||||
if re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()) and inp != "":
|
if re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()) and inp != "":
|
||||||
|
|
|
@ -23,7 +23,7 @@ body = ['head',
|
||||||
|
|
||||||
@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> - kill a user"
|
".kill <user> -- Makes the bot kill <user>."
|
||||||
inp = inp.strip()
|
inp = inp.strip()
|
||||||
|
|
||||||
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
||||||
|
|
|
@ -8,7 +8,7 @@ def lastfm(inp, nick='', say=None, db=None, bot=None):
|
||||||
user = inp
|
user = inp
|
||||||
else:
|
else:
|
||||||
user = nick
|
user = nick
|
||||||
".lastfm <user> -- displays the now playing (or recent) tracks of a LastFM user"
|
".lastfm <user> -- Displays the now playing (or recent) tracks of LastFM user <user>."
|
||||||
db.execute("create table if not exists lastfm(nick primary key, acc)")
|
db.execute("create table if not exists lastfm(nick primary key, acc)")
|
||||||
sql = db.execute("select acc from lastfm where nick=lower(?)", (nick,)).fetchone();
|
sql = db.execute("select acc from lastfm where nick=lower(?)", (nick,)).fetchone();
|
||||||
api_url = "http://ws.audioscrobbler.com/2.0/?format=json"
|
api_url = "http://ws.audioscrobbler.com/2.0/?format=json"
|
||||||
|
|
|
@ -21,7 +21,7 @@ def get_info(host, port):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def mcping(inp):
|
def mcping(inp):
|
||||||
".mcping server[:port] - ping a minecraft server and show response."
|
".mcping server[:port] - Ping a Minecraft server to check status.."
|
||||||
inp = inp.strip().split(" ")[0]
|
inp = inp.strip().split(" ")[0]
|
||||||
|
|
||||||
if ":" in inp:
|
if ":" in inp:
|
||||||
|
|
|
@ -3,7 +3,7 @@ import string
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def mcstatus(inp, bot=None):
|
def mcstatus(inp, bot=None):
|
||||||
".mcstatus -- Attempts to log in to minecraft"
|
".mcstatus -- Checks the status of Minecraft's login servers."
|
||||||
username = bot.config.get("api_keys", {}).get("mc_user", None)
|
username = bot.config.get("api_keys", {}).get("mc_user", None)
|
||||||
password = bot.config.get("api_keys", {}).get("mc_pass", None)
|
password = bot.config.get("api_keys", {}).get("mc_pass", None)
|
||||||
if password is None:
|
if password is None:
|
||||||
|
@ -13,11 +13,11 @@ def mcstatus(inp, bot=None):
|
||||||
if username.lower() in login.lower():
|
if username.lower() in login.lower():
|
||||||
return "Minecraft login servers appear to be online!"
|
return "Minecraft login servers appear to be online!"
|
||||||
else:
|
else:
|
||||||
return "Minecraft login servers appear to be offline :("
|
return "Minecraft login servers appear to be offline!"
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def mclogin(inp, say=None):
|
def mclogin(inp, say=None):
|
||||||
".mclogin <username> <password> -- Attempts to log in to minecraft using the provided username and password, this is NOT logged."
|
".mclogin <username> <password> -- Attempts to log in to Minecrat with <username> and <password> (This is NOT logged)."
|
||||||
inp = inp.split(" ")
|
inp = inp.split(" ")
|
||||||
username = inp[0]
|
username = inp[0]
|
||||||
password = inp[1]
|
password = inp[1]
|
||||||
|
@ -26,14 +26,14 @@ def mclogin(inp, say=None):
|
||||||
if username.lower() in login.lower():
|
if username.lower() in login.lower():
|
||||||
return "I logged in with " + username
|
return "I logged in with " + username
|
||||||
else:
|
else:
|
||||||
return "I couldn't log in using " + username + ", either the password is wrong or minecraft login servers are down D:"
|
return "I couldn't log in using " + username + ", either the password is wrong or minecraft login servers are down!"
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def mcpaid(inp):
|
def mcpaid(inp):
|
||||||
".mcpaid <username> -- Checks if a user has a premium Minecraft account"
|
".mcpaid <username> -- Checks if <username> has a premium Minecraft account."
|
||||||
login = http.get("http://www.minecraft.net/haspaid.jsp?user=" + inp)
|
login = http.get("http://www.minecraft.net/haspaid.jsp?user=" + inp)
|
||||||
if "true" in login:
|
if "true" in login:
|
||||||
return "The account \'" + inp + "\' is a premium Minecraft account! :D"
|
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!"
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from util import hook
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def mem(inp):
|
def mem(inp):
|
||||||
".mem -- returns bot's current memory usage -- linux/windows only"
|
".mem -- Display the bot's current memory usage."
|
||||||
|
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
status_file = open("/proc/%d/status" % os.getpid()).read()
|
status_file = open("/proc/%d/status" % os.getpid()).read()
|
||||||
|
|
|
@ -8,8 +8,7 @@ from util import hook, http
|
||||||
|
|
||||||
@hook.command('mc')
|
@hook.command('mc')
|
||||||
def metacritic(inp):
|
def metacritic(inp):
|
||||||
'.mc [all|movie|tv|album|x360|ps3|pc|ds|wii] <title> -- gets rating for'\
|
".mc [all|movie|tv|album|x360|ps3|pc|ds|wii] <title> -- Gets rating for <title> from metacritic on the specified medium."
|
||||||
' <title> from metacritic on the specified medium'
|
|
||||||
|
|
||||||
# if the results suck, it's metacritic's fault
|
# if the results suck, it's metacritic's fault
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from util import hook, http
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def mtg(inp):
|
def mtg(inp):
|
||||||
".mtg <name> -- gets information about Magic the Gathering card <name>"
|
".mtg <name> -- Gets information about Magic the Gathering card <name>."
|
||||||
|
|
||||||
url = 'http://magiccards.info/query?v=card&s=cname'
|
url = 'http://magiccards.info/query?v=card&s=cname'
|
||||||
h = http.get_html(url, q=inp)
|
h = http.get_html(url, q=inp)
|
||||||
|
|
|
@ -6,7 +6,7 @@ from util import hook
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def munge(inp, munge_count=0):
|
def munge(inp, munge_count=0):
|
||||||
".munge <text> -- munges up the given text"
|
".munge <text> -- Munges up <text>."
|
||||||
reps = 0
|
reps = 0
|
||||||
for n in xrange(len(inp)):
|
for n in xrange(len(inp)):
|
||||||
rep = character_replacements.get(inp[n])
|
rep = character_replacements.get(inp[n])
|
||||||
|
@ -20,7 +20,7 @@ def munge(inp, munge_count=0):
|
||||||
|
|
||||||
character_replacements = {
|
character_replacements = {
|
||||||
'a': 'ä',
|
'a': 'ä',
|
||||||
# 'b': 'Б',
|
'b': 'Б',
|
||||||
'c': 'ċ',
|
'c': 'ċ',
|
||||||
'd': 'đ',
|
'd': 'đ',
|
||||||
'e': 'ë',
|
'e': 'ë',
|
||||||
|
@ -31,16 +31,16 @@ character_replacements = {
|
||||||
'j': 'ĵ',
|
'j': 'ĵ',
|
||||||
'k': 'ķ',
|
'k': 'ķ',
|
||||||
'l': 'ĺ',
|
'l': 'ĺ',
|
||||||
# 'm': 'ṁ',
|
'm': 'ṁ',
|
||||||
'n': 'ñ',
|
'n': 'ñ',
|
||||||
'o': 'ö',
|
'o': 'ö',
|
||||||
'p': 'ρ',
|
'p': 'ρ',
|
||||||
# 'q': 'ʠ',
|
'q': 'ʠ',
|
||||||
'r': 'ŗ',
|
'r': 'ŗ',
|
||||||
's': 'š',
|
's': 'š',
|
||||||
't': 'ţ',
|
't': 'ţ',
|
||||||
'u': 'ü',
|
'u': 'ü',
|
||||||
# 'v': '',
|
'v': '',
|
||||||
'w': 'ω',
|
'w': 'ω',
|
||||||
'x': 'χ',
|
'x': 'χ',
|
||||||
'y': 'ÿ',
|
'y': 'ÿ',
|
||||||
|
@ -50,7 +50,7 @@ character_replacements = {
|
||||||
'C': 'Ç',
|
'C': 'Ç',
|
||||||
'D': 'Ď',
|
'D': 'Ď',
|
||||||
'E': 'Ē',
|
'E': 'Ē',
|
||||||
# 'F': 'Ḟ',
|
'F': 'Ḟ',
|
||||||
'G': 'Ġ',
|
'G': 'Ġ',
|
||||||
'H': 'Ħ',
|
'H': 'Ħ',
|
||||||
'I': 'Í',
|
'I': 'Í',
|
||||||
|
@ -61,12 +61,12 @@ character_replacements = {
|
||||||
'N': 'Ν',
|
'N': 'Ν',
|
||||||
'O': 'Ö',
|
'O': 'Ö',
|
||||||
'P': 'Р',
|
'P': 'Р',
|
||||||
# 'Q': 'Q',
|
'Q': 'Q',
|
||||||
'R': 'Ŗ',
|
'R': 'Ŗ',
|
||||||
'S': 'Š',
|
'S': 'Š',
|
||||||
'T': 'Ţ',
|
'T': 'Ţ',
|
||||||
'U': 'Ů',
|
'U': 'Ů',
|
||||||
# 'V': 'Ṿ',
|
'V': 'Ṿ',
|
||||||
'W': 'Ŵ',
|
'W': 'Ŵ',
|
||||||
'X': 'Χ',
|
'X': 'Χ',
|
||||||
'Y': 'Ỳ',
|
'Y': 'Ỳ',
|
||||||
|
|
|
@ -6,7 +6,7 @@ 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()
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,13 @@ def gen_password(types):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def password(inp, notice=None):
|
def password(inp, notice=None):
|
||||||
".password <length> [types] -- generates a password. types can include 'alpha', 'no caps', 'numeric', 'symbols' or any combination of the types, eg. 'numbers symbols'"
|
".password <length> [types] -- Generates a password of <legenth>. [types] can include 'alpha', 'no caps', 'numeric', 'symbols' or any combination of the types, eg. 'numbers symbols'"
|
||||||
if inp == "penis":
|
if inp == "penis":
|
||||||
return "Unable to process request, input too short"
|
return "error: unable to process request, input too short!"
|
||||||
|
if inp == "mypenis":
|
||||||
|
return "error: unable to process request, input too short!"
|
||||||
|
if inp == "dick":
|
||||||
|
return "error: unable to process request, input too short!"
|
||||||
|
if inp == "mydick":
|
||||||
|
return "error: unable to process request, input too short!"
|
||||||
notice(gen_password(inp))
|
notice(gen_password(inp))
|
||||||
|
|
|
@ -6,7 +6,7 @@ potatoes = ['AC Belmont', 'AC Blue Pride', 'AC Brador', 'AC Chaleur', 'AC Domino
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def potato(inp, me = None, input=None):
|
def potato(inp, me = None, input=None):
|
||||||
".potato <user> - makes the user a tasty little potato"
|
".potato <user> - Makes <user> a tasty little potato."
|
||||||
inp = inp.strip()
|
inp = inp.strip()
|
||||||
|
|
||||||
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
||||||
|
|
|
@ -8,7 +8,7 @@ re_lineends = re.compile(r'[\r\n]*')
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def python(inp):
|
def python(inp):
|
||||||
".python <prog> -- executes python code <prog>"
|
".python <prog> -- Executes <prog> as Python code."
|
||||||
|
|
||||||
inp = inp.replace("~n", "\n")
|
inp = inp.replace("~n", "\n")
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,13 @@ import time
|
||||||
from util import hook
|
from util import hook
|
||||||
|
|
||||||
def format_quote(q, num, n_quotes):
|
def format_quote(q, num, n_quotes):
|
||||||
"""Returns a formatted string of a quote"""
|
"Returns a formatted string of a quote"
|
||||||
ctime, nick, msg = q
|
ctime, nick, msg = q
|
||||||
return "[%d/%d] <%s> %s" % (num, n_quotes,
|
return "[%d/%d] <%s> %s" % (num, n_quotes,
|
||||||
nick, msg)
|
nick, msg)
|
||||||
|
|
||||||
def create_table_if_not_exists(db):
|
def create_table_if_not_exists(db):
|
||||||
"""Creates an empty quote table if one does not already exist"""
|
"Creates an empty quote table if one does not already exist"
|
||||||
db.execute('''CREATE TABLE IF NOT EXISTS quote (
|
db.execute('''CREATE TABLE IF NOT EXISTS quote (
|
||||||
chan,
|
chan,
|
||||||
nick,
|
nick,
|
||||||
|
@ -24,7 +24,7 @@ def create_table_if_not_exists(db):
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
def add_quote(db, chan, nick, add_nick, msg):
|
def add_quote(db, chan, nick, add_nick, msg):
|
||||||
"""Adds a quote to a nick, returns message string"""
|
"Adds a quote to a nick, returns message string"
|
||||||
try:
|
try:
|
||||||
db.execute('''INSERT OR FAIL INTO quote
|
db.execute('''INSERT OR FAIL INTO quote
|
||||||
(chan, nick, add_nick, msg, time)
|
(chan, nick, add_nick, msg, time)
|
||||||
|
@ -36,7 +36,7 @@ def add_quote(db, chan, nick, add_nick, msg):
|
||||||
return "Quote added."
|
return "Quote added."
|
||||||
|
|
||||||
def del_quote(db, chan, nick, add_nick, msg):
|
def del_quote(db, chan, nick, add_nick, msg):
|
||||||
"""Deletes a quote from a nick"""
|
"Deletes a quote from a nick"
|
||||||
db.execute('''UPDATE quote
|
db.execute('''UPDATE quote
|
||||||
SET deleted = 1
|
SET deleted = 1
|
||||||
WHERE chan=?
|
WHERE chan=?
|
||||||
|
@ -45,7 +45,7 @@ def del_quote(db, chan, nick, add_nick, msg):
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
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.
|
||||||
|
@ -61,7 +61,7 @@ def get_quote_num(num, count, name):
|
||||||
return num
|
return num
|
||||||
|
|
||||||
def get_quote_by_nick(db, chan, nick, num=False):
|
def get_quote_by_nick(db, chan, nick, num=False):
|
||||||
"""Returns a formatted quote from a nick, random or selected by number"""
|
"Returns a formatted quote from a nick, random or selected by number"
|
||||||
count = db.execute('''SELECT COUNT(*)
|
count = db.execute('''SELECT COUNT(*)
|
||||||
FROM quote
|
FROM quote
|
||||||
WHERE deleted != 1
|
WHERE deleted != 1
|
||||||
|
@ -83,7 +83,7 @@ def get_quote_by_nick(db, chan, nick, num=False):
|
||||||
return format_quote(quote, num, count)
|
return format_quote(quote, num, count)
|
||||||
|
|
||||||
def get_quote_by_chan(db, chan, num=False):
|
def get_quote_by_chan(db, chan, num=False):
|
||||||
"""Returns a formatted quote from a channel, random or selected by number"""
|
"Returns a formatted quote from a channel, random or selected by number"
|
||||||
count = db.execute('''SELECT COUNT(*)
|
count = db.execute('''SELECT COUNT(*)
|
||||||
FROM quote
|
FROM quote
|
||||||
WHERE deleted != 1
|
WHERE deleted != 1
|
||||||
|
@ -105,8 +105,8 @@ def get_quote_by_chan(db, chan, num=False):
|
||||||
@hook.command('q')
|
@hook.command('q')
|
||||||
@hook.command
|
@hook.command
|
||||||
def quote(inp, nick='', chan='', db=None, notice=None):
|
def quote(inp, nick='', chan='', db=None, notice=None):
|
||||||
".q/.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)
|
||||||
|
|
|
@ -139,7 +139,7 @@ pasters = dict(
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def repaste(inp, input=None, db=None, isManual=True):
|
def repaste(inp, input=None, db=None, isManual=True):
|
||||||
".repaste mode|list|[provider] [syntax] <pastebinurl> -- scrape mibpaste, reupload on given pastebin"
|
".repaste mode|list|[provider] [syntax] <pastebinurl> -- Reuploads mibpaste to [provider]."
|
||||||
|
|
||||||
parts = inp.split()
|
parts = inp.split()
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
|
|
@ -25,7 +25,7 @@ def seeninput(paraml, input=None, db=None, bot=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def seen(inp, nick='', chan='', db=None, input=None):
|
def seen(inp, nick='', chan='', db=None, input=None):
|
||||||
".seen <nick> -- Tell when a nickname was last in active in irc"
|
".seen <nick> -- Tell when a nickname was last in active in one of this bot's channels."
|
||||||
|
|
||||||
if input.conn.nick.lower() == inp.lower():
|
if input.conn.nick.lower() == inp.lower():
|
||||||
# user is looking for us, being a smartass
|
# user is looking for us, being a smartass
|
||||||
|
|
|
@ -24,7 +24,7 @@ def bitly(url, user, apikey):
|
||||||
|
|
||||||
@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)
|
||||||
if api_key is None:
|
if api_key is None:
|
||||||
|
@ -33,7 +33,7 @@ def shorten(inp, bot = None):
|
||||||
|
|
||||||
@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)
|
||||||
except HTTPError, e:
|
except HTTPError, e:
|
||||||
|
|
|
@ -128,7 +128,7 @@ items = ["cast iron skillet",
|
||||||
|
|
||||||
@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> - LARTs a user of your choice"
|
".lart <user> -- Makes the bot LART <user>."
|
||||||
inp = inp.strip()
|
inp = inp.strip()
|
||||||
|
|
||||||
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
||||||
|
@ -144,7 +144,7 @@ def lart(inp, me = None, nick = None, input=None, notice=None):
|
||||||
|
|
||||||
@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> - slap a user"
|
".slap <user> -- Makes the bot slap <user>."
|
||||||
inp = inp.strip()
|
inp = inp.strip()
|
||||||
|
|
||||||
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
||||||
|
|
|
@ -8,7 +8,7 @@ def sloganize(word):
|
||||||
|
|
||||||
@hook.command("slogan")
|
@hook.command("slogan")
|
||||||
def sloganizr(inp, nick=None, say=None, input=None):
|
def sloganizr(inp, nick=None, say=None, input=None):
|
||||||
".slogan <word> -- make a solgan for <word>!"
|
".slogan <word> -- Makes a slogan for <word>."
|
||||||
slogan = sloganize(inp)
|
slogan = sloganize(inp)
|
||||||
|
|
||||||
slogan = misc.strip_html(slogan)
|
slogan = misc.strip_html(slogan)
|
||||||
|
|
|
@ -8,7 +8,7 @@ search_url = "http://search.atomz.com/search/?sp_a=00062d45-sp00000000"
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def snopes(inp):
|
def snopes(inp):
|
||||||
".snopes <topic> -- searches snopes for an urban legend about <topic>"
|
".snopes <topic> -- Searches snopes for an urban legend about <topic>."
|
||||||
|
|
||||||
search_page = http.get_html(search_url, sp_q=inp, sp_c="1")
|
search_page = http.get_html(search_url, sp_q=inp, sp_c="1")
|
||||||
result_urls = search_page.xpath("//a[@target='_self']/@href")
|
result_urls = search_page.xpath("//a[@target='_self']/@href")
|
||||||
|
|
|
@ -6,7 +6,7 @@ import enchant
|
||||||
|
|
||||||
@hook.command("spellcheck")
|
@hook.command("spellcheck")
|
||||||
def spell(inp):
|
def spell(inp):
|
||||||
'''.time <area> -- gets the time in <area>'''
|
".spell <word> -- Check spelling of <word>."
|
||||||
d = enchant.Dict("en_US")
|
d = enchant.Dict("en_US")
|
||||||
|
|
||||||
if not (inp.split()[-1] == inp):
|
if not (inp.split()[-1] == inp):
|
||||||
|
|
|
@ -5,7 +5,7 @@ from util import hook, http
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def stock(inp):
|
def stock(inp):
|
||||||
'''.stock <symbol> -- gets information about a stock symbol'''
|
".stock <symbol> -- Gets information about stock symbol <symbol>."
|
||||||
|
|
||||||
url = 'http://www.google.com/ig/api?stock=%s'
|
url = 'http://www.google.com/ig/api?stock=%s'
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ def tellinput(paraml, input=None, db=None, bot=None):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def showtells(inp, nick='', chan='', notice=None, db=None):
|
def showtells(inp, nick='', chan='', notice=None, db=None):
|
||||||
".showtells -- view all pending tell messages (sent in a notice)."
|
".showtells -- View all pending tell messages (sent in a notice)."
|
||||||
|
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ def showtells(inp, nick='', chan='', notice=None, db=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def tell(inp, nick='', chan='', db=None, input=None, notice=None):
|
def tell(inp, nick='', chan='', db=None, input=None, notice=None):
|
||||||
".tell <nick> <message> -- relay <message> to <nick> when <nick> is around"
|
".tell <nick> <message> -- Relay <message> to <nick> when <nick> is around."
|
||||||
query = inp.split(' ', 1)
|
query = inp.split(' ', 1)
|
||||||
|
|
||||||
if len(query) != 2:
|
if len(query) != 2:
|
||||||
|
|
|
@ -90,7 +90,7 @@ def db_search(db, nick, query):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def todo(inp, nick='', chan='', db=None, notice=None, bot=None):
|
def todo(inp, nick='', chan='', db=None, notice=None, bot=None):
|
||||||
"todo (add|del|list|search) [@user] args -- manipulates your todos"
|
".todo (add|del|list|search) [@user] args -- Manipulates your list of todos."
|
||||||
|
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,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_next <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)
|
||||||
if api_key is None:
|
if api_key is None:
|
||||||
|
@ -135,7 +135,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)
|
||||||
if api_key is None:
|
if api_key is None:
|
||||||
|
|
|
@ -52,9 +52,9 @@ def parseDateTime(s):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def twitter(inp):
|
def twitter(inp):
|
||||||
".twitter <user>/<user> <n>/<id>/#<hashtag>/@<user> -- gets last/<n>th "\
|
".twitter <user>/<user> <n>/<id>/#<hashtag>/@<user> -- Gets last/<n>th "\
|
||||||
"tweet from <user>/gets tweet <id>/gets random tweet with #<hashtag>/"\
|
"tweet from <user>/gets tweet <id>/Gets random tweet with #<hashtag>/"\
|
||||||
"gets replied tweet from @<user>"
|
"gets replied tweet from @<user>."
|
||||||
|
|
||||||
def add_reply(reply_name, reply_id):
|
def add_reply(reply_name, reply_id):
|
||||||
if len(history) == history_max_size:
|
if len(history) == history_max_size:
|
||||||
|
|
|
@ -9,7 +9,7 @@ from util import hook, http
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def validate(inp):
|
def validate(inp):
|
||||||
".validate <url> -- runs url through w3c markup validator"
|
".validate <url> -- Runs url through the w3c markup validator."
|
||||||
|
|
||||||
if not inp.startswith('http://'):
|
if not inp.startswith('http://'):
|
||||||
inp = 'http://' + inp
|
inp = 'http://' + inp
|
||||||
|
|
|
@ -4,7 +4,7 @@ from util import hook, http
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def forecast(inp, nick='', server='', reply=None, db=None, notice=None, say=None):
|
def forecast(inp, nick='', server='', reply=None, db=None, notice=None, say=None):
|
||||||
".forecast <location> [dontsave] -- gets a weather forecast from Google"
|
".forecast <location> [dontsave] -- Gets a weather forecast for <location> from Google."
|
||||||
loc = inp
|
loc = inp
|
||||||
|
|
||||||
dontsave = loc.endswith(" dontsave")
|
dontsave = loc.endswith(" dontsave")
|
||||||
|
@ -44,7 +44,7 @@ def forecast(inp, nick='', server='', reply=None, db=None, notice=None, say=None
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def weather(inp, nick='', server='', reply=None, db=None, notice=None):
|
def weather(inp, nick='', server='', reply=None, db=None, notice=None):
|
||||||
".weather <location> [dontsave] -- gets weather data from Google"
|
".weather <location> [dontsave] -- Gets weather data for <location> from Google."
|
||||||
loc = inp
|
loc = inp
|
||||||
|
|
||||||
dontsave = loc.endswith(" dontsave")
|
dontsave = loc.endswith(" dontsave")
|
||||||
|
|
|
@ -2,6 +2,7 @@ from util import pywhois, hook
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def whois(inp, say=None):
|
def whois(inp, say=None):
|
||||||
|
".whois <domain> -- Look up ownership infomation for <domain>"
|
||||||
try:
|
try:
|
||||||
w = pywhois.whois(inp)
|
w = pywhois.whois(inp)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -15,8 +15,7 @@ paren_re = re.compile('\s*\(.*\)$')
|
||||||
@hook.command('w')
|
@hook.command('w')
|
||||||
@hook.command
|
@hook.command
|
||||||
def wiki(inp):
|
def wiki(inp):
|
||||||
'''.w/.wiki <phrase> -- gets first sentence of wikipedia ''' \
|
".wiki <phrase> -- Gets first sentence of Wikipedia article on <phrase>."
|
||||||
'''article on <phrase>'''
|
|
||||||
|
|
||||||
x = http.get_xml(search_url, search=inp)
|
x = http.get_xml(search_url, search=inp)
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from util import hook, http
|
||||||
@hook.command('wa')
|
@hook.command('wa')
|
||||||
@hook.command
|
@hook.command
|
||||||
def wolframalpha(inp, bot=None):
|
def wolframalpha(inp, bot=None):
|
||||||
".wa/.wolframalpha <query> -- computes <query> using Wolfram Alpha"
|
".wa <query> -- Computes <query> using Wolfram Alpha."
|
||||||
|
|
||||||
api_key = bot.config.get("api_keys", {}).get("wolframalpha", None)
|
api_key = bot.config.get("api_keys", {}).get("wolframalpha", None)
|
||||||
if api_key is None:
|
if api_key is None:
|
||||||
|
|
|
@ -4,7 +4,7 @@ from BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def word(inp, say=False, nick=False):
|
def word(inp, say=False, nick=False):
|
||||||
".word -- gets the word of the day"
|
".word -- Gets the word of the day."
|
||||||
page = http.get('http://merriam-webster.com/word-of-the-day')
|
page = http.get('http://merriam-webster.com/word-of-the-day')
|
||||||
|
|
||||||
soup = BeautifulSoup(page)
|
soup = BeautifulSoup(page)
|
||||||
|
|
|
@ -68,7 +68,7 @@ def youtube_url(match):
|
||||||
@hook.command('y')
|
@hook.command('y')
|
||||||
@hook.command
|
@hook.command
|
||||||
def youtube(inp):
|
def youtube(inp):
|
||||||
'.youtube <query> -- returns the first YouTube search result for <query>'
|
".youtube <query> -- Returns the first YouTube search result for <query>."
|
||||||
|
|
||||||
j = http.get_json(search_api_url, q=inp)
|
j = http.get_json(search_api_url, q=inp)
|
||||||
|
|
||||||
|
|
Reference in a new issue