Updated helpstrings
This commit is contained in:
parent
75a001ad5d
commit
54cf797b1e
60 changed files with 104 additions and 104 deletions
|
@ -36,6 +36,6 @@ 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, " \
|
"8ball <question> -- The all knowing magic eight ball, " \
|
||||||
"in electronic form. Ask and it shall be answered!"
|
"in electronic form. Ask and it shall be answered!"
|
||||||
me("shakes the magic 8 ball... %s" % (random.choice(answers)))
|
me("shakes the magic 8 ball... %s" % (random.choice(answers)))
|
||||||
|
|
|
@ -10,7 +10,7 @@ import subprocess
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def addadmin(inp, notice=None, bot=None, config=None):
|
def addadmin(inp, notice=None, bot=None, config=None):
|
||||||
".addadmin <nick|host> -- Make <nick|host> an admin. " \
|
"addadmin <nick|host> -- Make <nick|host> an admin. " \
|
||||||
"(you can add multiple admins at once)"
|
"(you can add multiple admins at once)"
|
||||||
targets = inp.split()
|
targets = inp.split()
|
||||||
for target in targets:
|
for target in targets:
|
||||||
|
@ -26,7 +26,7 @@ def addadmin(inp, notice=None, bot=None, config=None):
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def deladmin(inp, notice=None, bot=None, config=None):
|
def deladmin(inp, notice=None, bot=None, config=None):
|
||||||
".deladmin <nick|host> -- Make <nick|host> a non-admin." \
|
"deladmin <nick|host> -- Make <nick|host> a non-admin." \
|
||||||
"(you can delete multiple admins at once)"
|
"(you can delete multiple admins at once)"
|
||||||
targets = inp.split()
|
targets = inp.split()
|
||||||
for target in targets:
|
for target in targets:
|
||||||
|
@ -42,14 +42,14 @@ def deladmin(inp, notice=None, bot=None, config=None):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def channels(inp, conn=None):
|
def channels(inp, conn=None):
|
||||||
".channels -- Lists the channels that the bot is in."
|
"channels -- Lists the channels that the bot is in."
|
||||||
return "I am in these channels: %s" % ", ".join(conn.channels)
|
return "I am in these channels: %s" % ", ".join(conn.channels)
|
||||||
|
|
||||||
|
|
||||||
@hook.command("quit", autohelp=False, adminonly=True)
|
@hook.command("quit", autohelp=False, adminonly=True)
|
||||||
@hook.command(autohelp=False, adminonly=True)
|
@hook.command(autohelp=False, adminonly=True)
|
||||||
def stop(inp, nick=None, conn=None):
|
def stop(inp, nick=None, conn=None):
|
||||||
".stop [reason] -- Kills the bot with [reason] as its quit message."
|
"stop [reason] -- Kills the bot with [reason] as its quit message."
|
||||||
if inp:
|
if inp:
|
||||||
conn.cmd("QUIT", ["Killed by %s (%s)" % (nick, inp)])
|
conn.cmd("QUIT", ["Killed by %s (%s)" % (nick, inp)])
|
||||||
else:
|
else:
|
||||||
|
@ -60,7 +60,7 @@ def stop(inp, nick=None, conn=None):
|
||||||
|
|
||||||
@hook.command(autohelp=False, adminonly=True)
|
@hook.command(autohelp=False, adminonly=True)
|
||||||
def restart(inp, nick=None, conn=None):
|
def restart(inp, nick=None, conn=None):
|
||||||
".restart [reason] -- Restarts the bot with [reason] as its quit message."
|
"restart [reason] -- Restarts the bot with [reason] as its quit message."
|
||||||
if inp:
|
if inp:
|
||||||
conn.cmd("QUIT", ["Restarted by %s (%s)" % (nick, inp)])
|
conn.cmd("QUIT", ["Restarted by %s (%s)" % (nick, inp)])
|
||||||
else:
|
else:
|
||||||
|
@ -71,20 +71,20 @@ def restart(inp, nick=None, conn=None):
|
||||||
|
|
||||||
@hook.command(autohelp=False, adminonly=True)
|
@hook.command(autohelp=False, adminonly=True)
|
||||||
def clearlogs(inp, input=None):
|
def clearlogs(inp, input=None):
|
||||||
".clearlogs -- Clears the bots log(s)."
|
"clearlogs -- Clears the bots log(s)."
|
||||||
subprocess.call(["./cloudbot", "clear"])
|
subprocess.call(["./cloudbot", "clear"])
|
||||||
|
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def join(inp, conn=None, notice=None):
|
def join(inp, conn=None, notice=None):
|
||||||
".join <channel> -- Joins <channel>."
|
"join <channel> -- Joins <channel>."
|
||||||
notice("Attempting to join %s..." % inp)
|
notice("Attempting to join %s..." % inp)
|
||||||
conn.join(inp)
|
conn.join(inp)
|
||||||
|
|
||||||
|
|
||||||
@hook.command(autohelp=False, adminonly=True)
|
@hook.command(autohelp=False, adminonly=True)
|
||||||
def part(inp, conn=None, chan=None, notice=None):
|
def part(inp, conn=None, chan=None, notice=None):
|
||||||
".part <channel> -- Leaves <channel>." \
|
"part <channel> -- Leaves <channel>." \
|
||||||
"If [channel] is blank the bot will leave the " \
|
"If [channel] is blank the bot will leave the " \
|
||||||
"channel the command was used in."
|
"channel the command was used in."
|
||||||
if inp:
|
if inp:
|
||||||
|
@ -97,7 +97,7 @@ def part(inp, conn=None, chan=None, notice=None):
|
||||||
|
|
||||||
@hook.command(autohelp=False, adminonly=True)
|
@hook.command(autohelp=False, adminonly=True)
|
||||||
def cycle(inp, conn=None, chan=None, notice=None):
|
def cycle(inp, conn=None, chan=None, notice=None):
|
||||||
".cycle <channel> -- Cycles <channel>." \
|
"cycle <channel> -- Cycles <channel>." \
|
||||||
"If [channel] is blank the bot will cycle the " \
|
"If [channel] is blank the bot will cycle the " \
|
||||||
"channel the command was used in."
|
"channel the command was used in."
|
||||||
if inp:
|
if inp:
|
||||||
|
@ -111,7 +111,7 @@ def cycle(inp, conn=None, chan=None, notice=None):
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def nick(inp, input=None, notice=None, conn=None):
|
def nick(inp, input=None, notice=None, conn=None):
|
||||||
".nick <nick> -- Changes the bots nickname to <nick>."
|
"nick <nick> -- Changes the bots nickname to <nick>."
|
||||||
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
||||||
notice("Invalid username!")
|
notice("Invalid username!")
|
||||||
return
|
return
|
||||||
|
@ -121,14 +121,14 @@ def nick(inp, input=None, notice=None, conn=None):
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def raw(inp, conn=None, notice=None):
|
def raw(inp, conn=None, notice=None):
|
||||||
".raw <command> -- Sends a RAW IRC command."
|
"raw <command> -- Sends a RAW IRC command."
|
||||||
notice("Raw command sent.")
|
notice("Raw command sent.")
|
||||||
conn.send(inp)
|
conn.send(inp)
|
||||||
|
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def say(inp, conn=None, chan=None, notice=None):
|
def say(inp, conn=None, chan=None, notice=None):
|
||||||
".say [channel] <message> -- Makes the bot say <message> in [channel]. " \
|
"say [channel] <message> -- Makes the bot say <message> in [channel]. " \
|
||||||
"If [channel] is blank the bot will say the <message> in the channel " \
|
"If [channel] is blank the bot will say the <message> in the channel " \
|
||||||
"the command was used in."
|
"the command was used in."
|
||||||
inp = inp.split(" ")
|
inp = inp.split(" ")
|
||||||
|
@ -150,7 +150,7 @@ def say(inp, conn=None, chan=None, notice=None):
|
||||||
@hook.command("act", adminonly=True)
|
@hook.command("act", adminonly=True)
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def me(inp, conn=None, chan=None, notice=None):
|
def me(inp, conn=None, chan=None, notice=None):
|
||||||
".me [channel] <action> -- Makes the bot act out <action> in [channel]. " \
|
"me [channel] <action> -- Makes the bot act out <action> in [channel]. " \
|
||||||
"If [channel] is blank the bot will act the <action> in the channel the " \
|
"If [channel] is blank the bot will act the <action> in the channel the " \
|
||||||
"command was used in."
|
"command was used in."
|
||||||
inp = inp.split(" ")
|
inp = inp.split(" ")
|
||||||
|
|
|
@ -14,7 +14,7 @@ MAX_STEPS = 1000000
|
||||||
@hook.command('brainfuck')
|
@hook.command('brainfuck')
|
||||||
@hook.command
|
@hook.command
|
||||||
def bf(inp):
|
def bf(inp):
|
||||||
".bf <prog> -- Executes <prog> as Brainfuck code."
|
"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"
|
||||||
|
|
|
@ -6,7 +6,7 @@ from util import hook
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def choose(inp):
|
def choose(inp):
|
||||||
".choose <choice1>, [choice2], [choice3], [choice4], ... -- " \
|
"choose <choice1>, [choice2], [choice3], [choice4], ... -- " \
|
||||||
"Randomly picks one of the given choices."
|
"Randomly picks one of the given choices."
|
||||||
|
|
||||||
c = re.findall(r'([^,]+)', inp)
|
c = re.findall(r'([^,]+)', inp)
|
||||||
|
|
|
@ -16,7 +16,7 @@ def flip_simple(count):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def coin(inp):
|
def coin(inp):
|
||||||
".coin [amount] -- Flips [amount] of coins."
|
"coin [amount] -- Flips [amount] of coins."
|
||||||
# checking for valid input. if valid input [count=inp],
|
# checking for valid input. if valid input [count=inp],
|
||||||
# if invalid [return error], if no input [count=1]
|
# if invalid [return error], if no input [count=1]
|
||||||
if inp.isdigit():
|
if inp.isdigit():
|
||||||
|
|
|
@ -11,7 +11,7 @@ len_chars = len(chars)
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def cypher(inp):
|
def cypher(inp):
|
||||||
".cypher <pass> <string> -- Cyphers <string> with <password>."
|
"cypher <pass> <string> -- Cyphers <string> with <password>."
|
||||||
|
|
||||||
passwd = inp.split(" ")[0]
|
passwd = inp.split(" ")[0]
|
||||||
len_passwd = len(passwd)
|
len_passwd = len(passwd)
|
||||||
|
@ -38,7 +38,7 @@ def cypher(inp):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def decypher(inp):
|
def decypher(inp):
|
||||||
".decypher <pass> <string> -- Decyphers <string> with <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,8 +36,8 @@ 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. Example of <diceroll>:" \
|
"dice <diceroll> -- Simulates dicerolls. Example of <diceroll>:" \
|
||||||
" '.dice 2d20-d5+4 roll 2'. D20s, subtract 1D5, add 4"
|
" 'dice 2d20-d5+4 roll 2'. D20s, subtract 1D5, add 4"
|
||||||
|
|
||||||
try: # if inp is a re.match object...
|
try: # if inp is a re.match object...
|
||||||
(inp, desc) = inp.groups()
|
(inp, desc) = inp.groups()
|
||||||
|
|
|
@ -7,7 +7,7 @@ from util import http
|
||||||
@hook.command('dictionary')
|
@hook.command('dictionary')
|
||||||
@hook.command
|
@hook.command
|
||||||
def define(inp):
|
def define(inp):
|
||||||
".define <word> -- Fetches definition of <word>."
|
"define <word> -- Fetches definition of <word>."
|
||||||
|
|
||||||
url = 'http://ninjawords.com/'
|
url = 'http://ninjawords.com/'
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ def define(inp):
|
||||||
@hook.command('e')
|
@hook.command('e')
|
||||||
@hook.command
|
@hook.command
|
||||||
def etymology(inp):
|
def etymology(inp):
|
||||||
".etymology <word> -- Retrieves the etymology of <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 if the site at <url> is up or 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
|
||||||
|
|
|
@ -6,7 +6,7 @@ ed_url = "http://encyclopediadramatica.se/"
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def drama(inp):
|
def drama(inp):
|
||||||
".drama <phrase> -- Gets the first paragraph of" \
|
"drama <phrase> -- Gets the first paragraph of" \
|
||||||
" the Encyclopedia Dramatica article on <phrase>."
|
" the Encyclopedia Dramatica article on <phrase>."
|
||||||
|
|
||||||
j = http.get_json(api_url, search=inp)
|
j = http.get_json(api_url, search=inp)
|
||||||
|
|
|
@ -7,7 +7,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 random fact from OMGFACTS."
|
"fact -- Gets a random fact from OMGFACTS."
|
||||||
|
|
||||||
fact = None
|
fact = None
|
||||||
while fact is None:
|
while fact is None:
|
||||||
|
|
|
@ -46,7 +46,7 @@ def multiwordReplace(text, wordDic):
|
||||||
@hook.command("r", adminonly=True)
|
@hook.command("r", adminonly=True)
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def remember(inp, nick='', db=None, say=None, input=None, notice=None):
|
def remember(inp, nick='', db=None, say=None, input=None, notice=None):
|
||||||
".remember <word> [+]<data> -- Remembers <data> with <word>. Add +"
|
"remember <word> [+]<data> -- Remembers <data> with <word>. Add +"
|
||||||
" to <data> to append."
|
" to <data> to append."
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ def remember(inp, nick='', db=None, say=None, input=None, notice=None):
|
||||||
@hook.command("f", adminonly=True)
|
@hook.command("f", adminonly=True)
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
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>."
|
||||||
|
|
||||||
db_init(db)
|
db_init(db)
|
||||||
data = get_memory(db, inp)
|
data = get_memory(db, inp)
|
||||||
|
@ -106,7 +106,7 @@ def forget(inp, db=None, input=None, notice=None):
|
||||||
|
|
||||||
@hook.command()
|
@hook.command()
|
||||||
def info(inp, notice=None, db=None):
|
def info(inp, notice=None, db=None):
|
||||||
".info <factoid> -- Shows the source of a factoid."
|
"info <factoid> -- Shows the source of a factoid."
|
||||||
|
|
||||||
db_init(db)
|
db_init(db)
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ with open("plugins/data/flirts.txt") as f:
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def insult(inp, nick=None, me=None, conn=None):
|
def insult(inp, nick=None, me=None, conn=None):
|
||||||
".insult <user> -- Makes the bot insult <user>."
|
"insult <user> -- Makes the bot insult <user>."
|
||||||
target = inp.strip()
|
target = inp.strip()
|
||||||
|
|
||||||
if not re.match(nick_re, target):
|
if not re.match(nick_re, target):
|
||||||
|
@ -34,7 +34,7 @@ def insult(inp, nick=None, me=None, conn=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def flirt(inp, nick=None, me=None, conn=None):
|
def flirt(inp, nick=None, me=None, conn=None):
|
||||||
".flirt <user> -- Make the bot flirt with <user>."
|
"flirt <user> -- Make the bot flirt with <user>."
|
||||||
target = inp.strip()
|
target = inp.strip()
|
||||||
|
|
||||||
if not re.match(nick_re, target):
|
if not re.match(nick_re, target):
|
||||||
|
|
|
@ -4,7 +4,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 <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()
|
||||||
inp = inp[::-1]
|
inp = inp[::-1]
|
||||||
|
|
|
@ -26,7 +26,7 @@ refresh_cache()
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def fml(inp, reply=None):
|
def fml(inp, reply=None):
|
||||||
".fml -- Gets a random quote from fmyfife.com."
|
"fml -- Gets a random quote from fmyfife.com."
|
||||||
|
|
||||||
# grab the last item in the fml cache and remove it
|
# grab the last item in the fml cache and remove it
|
||||||
id, text = fml_cache.popitem()
|
id, text = fml_cache.popitem()
|
||||||
|
|
|
@ -13,5 +13,5 @@ with open("plugins/data/fortunes.txt") as f:
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def fortune(inp):
|
def fortune(inp):
|
||||||
".fortune -- Fortune cookies on demand."
|
"fortune -- Fortune cookies on demand."
|
||||||
return random.choice(fortunes)
|
return random.choice(fortunes)
|
||||||
|
|
|
@ -7,7 +7,7 @@ from BeautifulSoup import BeautifulSoup
|
||||||
@hook.command("math")
|
@hook.command("math")
|
||||||
@hook.command
|
@hook.command
|
||||||
def calc(inp):
|
def calc(inp):
|
||||||
".calc <term> -- Calculate <term> with Google Calc."
|
"calc <term> -- Calculate <term> with Google Calc."
|
||||||
|
|
||||||
white_re = re.compile(r'\s+')
|
white_re = re.compile(r'\s+')
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import urllib2
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def gitio(inp):
|
def gitio(inp):
|
||||||
".gitio <url> [code] -- Shorten Github URLs with git.io. [code] is" \
|
"gitio <url> [code] -- Shorten Github URLs with git.io. [code] is" \
|
||||||
" a optional custom short code."
|
" a optional custom short code."
|
||||||
split = inp.split(" ")
|
split = inp.split(" ")
|
||||||
url = split[0]
|
url = split[0]
|
||||||
|
|
|
@ -15,7 +15,7 @@ def api_get(kind, query):
|
||||||
@hook.command('gis')
|
@hook.command('gis')
|
||||||
@hook.command
|
@hook.command
|
||||||
def googleimage(inp):
|
def googleimage(inp):
|
||||||
".gis <query> -- Returns first Google Image result for <query>."
|
"gis <query> -- Returns first Google Image result for <query>."
|
||||||
|
|
||||||
parsed = api_get('images', inp)
|
parsed = api_get('images', inp)
|
||||||
if not 200 <= parsed['responseStatus'] < 300:
|
if not 200 <= parsed['responseStatus'] < 300:
|
||||||
|
@ -31,7 +31,7 @@ def googleimage(inp):
|
||||||
@hook.command('g')
|
@hook.command('g')
|
||||||
@hook.command
|
@hook.command
|
||||||
def google(inp):
|
def google(inp):
|
||||||
".google <query> -- Returns first google search result for <query>."
|
"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:
|
||||||
|
|
|
@ -4,30 +4,30 @@ 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'])
|
for x in ['md5', 'sha1', 'sha256'])
|
||||||
|
|
|
@ -4,7 +4,7 @@ from util import hook
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def help(inp, say=None, notice=None, input=None, conn=None, bot=None):
|
def help(inp, say=None, notice=None, input=None, conn=None, bot=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', [])
|
||||||
|
|
|
@ -21,7 +21,7 @@ def ignoresieve(bot, input, func, type, args):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def ignored(inp, notice=None, bot=None):
|
def ignored(inp, notice=None, bot=None):
|
||||||
".ignored -- Lists ignored channels/nicks/hosts."
|
"ignored -- Lists ignored channels/nicks/hosts."
|
||||||
ignorelist = bot.config["plugins"]["ignore"]["ignored"]
|
ignorelist = bot.config["plugins"]["ignore"]["ignored"]
|
||||||
if ignorelist:
|
if ignorelist:
|
||||||
notice("Ignored channels/nicks/hosts are: %s" % ", ".join(ignorelist))
|
notice("Ignored channels/nicks/hosts are: %s" % ", ".join(ignorelist))
|
||||||
|
@ -32,7 +32,7 @@ def ignored(inp, notice=None, bot=None):
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def ignore(inp, notice=None, bot=None, config=None):
|
def ignore(inp, notice=None, bot=None, config=None):
|
||||||
".ignore <channel|nick|host> -- Makes the bot ignore <channel|nick|host>."
|
"ignore <channel|nick|host> -- Makes the bot ignore <channel|nick|host>."
|
||||||
target = inp.lower()
|
target = inp.lower()
|
||||||
ignorelist = bot.config["plugins"]["ignore"]["ignored"]
|
ignorelist = bot.config["plugins"]["ignore"]["ignored"]
|
||||||
if target in ignorelist:
|
if target in ignorelist:
|
||||||
|
@ -47,7 +47,7 @@ def ignore(inp, notice=None, bot=None, config=None):
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def unignore(inp, notice=None, bot=None, config=None):
|
def unignore(inp, notice=None, bot=None, config=None):
|
||||||
".unignore <channel|nick|host> -- Makes the bot listen to"\
|
"unignore <channel|nick|host> -- Makes the bot listen to"\
|
||||||
" <channel|nick|host>."
|
" <channel|nick|host>."
|
||||||
target = inp.lower()
|
target = inp.lower()
|
||||||
ignorelist = bot.config["plugins"]["ignore"]["ignored"]
|
ignorelist = bot.config["plugins"]["ignore"]["ignored"]
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ from util import hook
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def admins(inp, notice=None, bot=None):
|
def admins(inp, notice=None, bot=None):
|
||||||
".admins -- Lists bot's admins."
|
"admins -- Lists bot's admins."
|
||||||
if bot.config["admins"]:
|
if bot.config["admins"]:
|
||||||
notice("Admins are: %s." % ", ".join(bot.config["admins"]))
|
notice("Admins are: %s." % ", ".join(bot.config["admins"]))
|
||||||
else:
|
else:
|
||||||
|
@ -12,5 +12,5 @@ def admins(inp, notice=None, bot=None):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def prefix(inp, notice=False, conn=False):
|
def prefix(inp, notice=False, conn=False):
|
||||||
".prefix -- Shows the bot's command prefix"
|
"prefix -- Shows the bot's command prefix"
|
||||||
notice("The prefix is: \"%s\"" % conn.conf["command_prefix"])
|
notice("The prefix is: \"%s\"" % conn.conf["command_prefix"])
|
|
@ -4,7 +4,7 @@ from datetime import datetime
|
||||||
@hook.command('l', autohelp=False)
|
@hook.command('l', autohelp=False)
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def lastfm(inp, nick='', say=None, db=None, bot=None):
|
def lastfm(inp, nick='', say=None, db=None, bot=None):
|
||||||
".lastfm [user] [dontsave] -- Displays the now playing (or last played)" \
|
"lastfm [user] [dontsave] -- Displays the now playing (or last played)" \
|
||||||
" track of LastFM user [user]."
|
" track of LastFM user [user]."
|
||||||
api_key = bot.config.get("api_keys", {}).get("lastfm")
|
api_key = bot.config.get("api_keys", {}).get("lastfm")
|
||||||
if not api_key:
|
if not api_key:
|
||||||
|
|
|
@ -51,7 +51,7 @@ with open("plugins/data/itemids.txt") as f:
|
||||||
@hook.command("id")
|
@hook.command("id")
|
||||||
@hook.command
|
@hook.command
|
||||||
def itemid(input, reply=None):
|
def itemid(input, reply=None):
|
||||||
".itemid/.id <item/id> -- gets the id from an item or vice versa"
|
"itemid <item/id> -- gets the id from an item or vice versa"
|
||||||
input = input.lower().strip()
|
input = input.lower().strip()
|
||||||
|
|
||||||
if input == "":
|
if input == "":
|
||||||
|
@ -84,7 +84,7 @@ def itemid(input, reply=None):
|
||||||
@hook.command("craft")
|
@hook.command("craft")
|
||||||
@hook.command
|
@hook.command
|
||||||
def recipe(input, reply=None):
|
def recipe(input, reply=None):
|
||||||
".recipe/.craft <item> -- gets the crafting recipe for an item"
|
"recipe <item> -- gets the crafting recipe for an item"
|
||||||
input = input.lower().strip()
|
input = input.lower().strip()
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
|
|
@ -25,7 +25,7 @@ def mcping_connect(host, port):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def mcstatus(inp, bot=None):
|
def mcstatus(inp, bot=None):
|
||||||
".mcstatus -- Checks the status of Minecraft's login servers."
|
"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:
|
||||||
|
@ -42,7 +42,7 @@ def mcstatus(inp, bot=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def mclogin(inp, say=None):
|
def mclogin(inp, say=None):
|
||||||
".mclogin <username> <password> -- Attempts to log in to Minecraft with" \
|
"mclogin <username> <password> -- Attempts to log in to Minecraft with" \
|
||||||
" <username> and <password> (This is NOT logged)."
|
" <username> and <password> (This is NOT logged)."
|
||||||
inp = inp.split(" ")
|
inp = inp.split(" ")
|
||||||
username = inp[0]
|
username = inp[0]
|
||||||
|
@ -61,7 +61,7 @@ def mclogin(inp, say=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def mcpaid(inp):
|
def mcpaid(inp):
|
||||||
".mcpaid <username> -- Checks if <username> has a" \
|
"mcpaid <username> -- Checks if <username> has a" \
|
||||||
" premium Minecraft account."
|
" 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)
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ def mcpaid(inp):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def mcping(inp):
|
def mcping(inp):
|
||||||
".mcping <server>[:port] - Ping a Minecraft server to check status."
|
"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:
|
||||||
|
|
|
@ -9,7 +9,7 @@ from util import hook, http
|
||||||
@hook.command('mc')
|
@hook.command('mc')
|
||||||
@hook.command
|
@hook.command
|
||||||
def metacritic(inp):
|
def metacritic(inp):
|
||||||
".mc [all|movie|tv|album|x360|ps3|pc|ds|wii] <title> -- Gets rating for <title> from metacritic on the specified medium."
|
"mc [all|movie|tv|album|x360|ps3|pc|ds|wii] <title> -- Gets rating for <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
|
||||||
|
|
||||||
|
|
|
@ -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 <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])
|
||||||
|
|
|
@ -6,8 +6,8 @@ from util.text import get_text_list
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def namegen(inp, notice=None):
|
def namegen(inp, notice=None):
|
||||||
".namegen [modules] -- Generates some names using the chosen modules. " \
|
"namegen [modules] -- Generates some names using the chosen modules. " \
|
||||||
"'.namegen list' will display a list of all modules."
|
"'namegen list' will display a list of all modules."
|
||||||
|
|
||||||
gen = molecular.Molecule()
|
gen = molecular.Molecule()
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ from util import hook
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def topic(inp, conn=None, chan=None, notice=None):
|
def topic(inp, conn=None, chan=None, notice=None):
|
||||||
".topic [channel] <topic> -- Change the topic of a channel."
|
"topic [channel] <topic> -- Change the topic of a channel."
|
||||||
inp = inp.split(" ")
|
inp = inp.split(" ")
|
||||||
if inp[0][0] == "#":
|
if inp[0][0] == "#":
|
||||||
out = "PRIVMSG %s :%s" % (inp[0], message)
|
out = "PRIVMSG %s :%s" % (inp[0], message)
|
||||||
|
@ -15,7 +15,7 @@ def topic(inp, conn=None, chan=None, notice=None):
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def kick(inp, chan=None, conn=None, notice=None):
|
def kick(inp, chan=None, conn=None, notice=None):
|
||||||
".kick [channel] <user> [reason] -- Makes the bot kick <user> in [channel] "\
|
"kick [channel] <user> [reason] -- Makes the bot kick <user> in [channel] "\
|
||||||
"If [channel] is blank the bot will kick the <user> in "\
|
"If [channel] is blank the bot will kick the <user> in "\
|
||||||
"the channel the command was used in."
|
"the channel the command was used in."
|
||||||
inp = inp.split(" ")
|
inp = inp.split(" ")
|
||||||
|
@ -45,7 +45,7 @@ def kick(inp, chan=None, conn=None, notice=None):
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def ban(inp, conn=None, chan=None, notice=None):
|
def ban(inp, conn=None, chan=None, notice=None):
|
||||||
".ban [channel] <user> -- Makes the bot ban <user> in [channel]. "\
|
"ban [channel] <user> -- Makes the bot ban <user> in [channel]. "\
|
||||||
"If [channel] is blank the bot will ban <user> in "\
|
"If [channel] is blank the bot will ban <user> in "\
|
||||||
"the channel the command was used in."
|
"the channel the command was used in."
|
||||||
inp = inp.split(" ")
|
inp = inp.split(" ")
|
||||||
|
@ -62,7 +62,7 @@ def ban(inp, conn=None, chan=None, notice=None):
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def unban(inp, conn=None, chan=None, notice=None):
|
def unban(inp, conn=None, chan=None, notice=None):
|
||||||
".unban [channel] <user> -- Makes the bot unban <user> in [channel]. "\
|
"unban [channel] <user> -- Makes the bot unban <user> in [channel]. "\
|
||||||
"If [channel] is blank the bot will unban <user> in "\
|
"If [channel] is blank the bot will unban <user> in "\
|
||||||
"the channel the command was used in."
|
"the channel the command was used in."
|
||||||
inp = inp.split(" ")
|
inp = inp.split(" ")
|
||||||
|
@ -79,7 +79,7 @@ def unban(inp, conn=None, chan=None, notice=None):
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def kickban(inp, chan=None, conn=None, notice=None):
|
def kickban(inp, chan=None, conn=None, notice=None):
|
||||||
".kickban [channel] <user> [reason] -- Makes the bot kickban <user> in [channel] "\
|
"kickban [channel] <user> [reason] -- Makes the bot kickban <user> in [channel] "\
|
||||||
"If [channel] is blank the bot will kickban the <user> in "\
|
"If [channel] is blank the bot will kickban the <user> in "\
|
||||||
"the channel the command was used in."
|
"the channel the command was used in."
|
||||||
inp = inp.split(" ")
|
inp = inp.split(" ")
|
||||||
|
|
|
@ -53,6 +53,6 @@ def gen_password(types):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def password(inp, notice=None):
|
def password(inp, notice=None):
|
||||||
".password <length> [types] -- Generates a password of <length> (default 10). [types] can include 'alpha', 'no caps', 'numeric', 'symbols' or any combination of the types, eg. 'numbers symbols'"
|
"password <length> [types] -- Generates a password of <length> (default 10). [types] can include 'alpha', 'no caps', 'numeric', 'symbols' or any combination of the types, eg. 'numbers symbols'"
|
||||||
password = gen_password(inp)
|
password = gen_password(inp)
|
||||||
notice(password)
|
notice(password)
|
||||||
|
|
|
@ -9,7 +9,7 @@ ping_regex = re.compile(r"(\d+.\d+)/(\d+.\d+)/(\d+.\d+)/(\d+.\d+)")
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def ping(inp, reply=None):
|
def ping(inp, reply=None):
|
||||||
".ping <host> [count] -- Pings <host> [count] times."
|
"ping <host> [count] -- Pings <host> [count] times."
|
||||||
|
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
return "Sorry, this command is not supported on Windows systems."
|
return "Sorry, this command is not supported on Windows systems."
|
||||||
|
|
|
@ -7,7 +7,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 <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 <prog> as Python code."
|
"python <prog> -- Executes <prog> as Python code."
|
||||||
|
|
||||||
inp = inp.replace("~n", "\n")
|
inp = inp.replace("~n", "\n")
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ 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):
|
||||||
".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)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ def seen_sieve(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 one of this bot's channels."
|
"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():
|
||||||
return "You need to get your eyes checked."
|
return "You need to get your eyes checked."
|
||||||
|
|
|
@ -7,7 +7,7 @@ from util.web import bitly, ShortenError
|
||||||
|
|
||||||
@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:
|
||||||
|
|
|
@ -10,7 +10,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> -- Makes a slogan 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")
|
||||||
|
|
|
@ -7,7 +7,7 @@ locale = "en_US"
|
||||||
|
|
||||||
@hook.command("spellcheck")
|
@hook.command("spellcheck")
|
||||||
def spell(inp):
|
def spell(inp):
|
||||||
".spell <word> -- Check spelling of <word>."
|
"spell <word> -- Check spelling of <word>."
|
||||||
word = inp
|
word = inp
|
||||||
|
|
||||||
if ' ' in word:
|
if ' ' in word:
|
||||||
|
|
|
@ -5,7 +5,7 @@ from util import hook, http
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def stock(inp):
|
def stock(inp):
|
||||||
".stock <symbol> -- Gets information about stock symbol <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'
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ def convert_kilobytes(kilobytes):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def system(inp):
|
def system(inp):
|
||||||
".system -- Retrieves information about the host system."
|
"system -- Retrieves information about the host system."
|
||||||
hostname = platform.node()
|
hostname = platform.node()
|
||||||
os = platform.platform()
|
os = platform.platform()
|
||||||
python_imp = platform.python_implementation()
|
python_imp = platform.python_implementation()
|
||||||
|
@ -31,7 +31,7 @@ def system(inp):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def memory(inp):
|
def memory(inp):
|
||||||
".memory -- Displays the bot's current memory usage."
|
"memory -- Displays the bot's current memory usage."
|
||||||
if os.name == "posix":
|
if os.name == "posix":
|
||||||
# get process info
|
# get process info
|
||||||
status_file = open('/proc/self/status').read()
|
status_file = open('/proc/self/status').read()
|
||||||
|
@ -63,7 +63,7 @@ def memory(inp):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def uptime(inp, bot=None):
|
def uptime(inp, bot=None):
|
||||||
".uptime -- Shows the bot's uptime."
|
"uptime -- Shows the bot's uptime."
|
||||||
uptime_raw = round(time.time() - bot.start_time)
|
uptime_raw = round(time.time() - bot.start_time)
|
||||||
uptime = timedelta(seconds=uptime_raw)
|
uptime = timedelta(seconds=uptime_raw)
|
||||||
return "Uptime: \x02%s\x02" % uptime
|
return "Uptime: \x02%s\x02" % uptime
|
||||||
|
@ -71,5 +71,5 @@ def uptime(inp, bot=None):
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def pid(inp):
|
def pid(inp):
|
||||||
".pid -- Prints the bot's PID."
|
"pid -- Prints the bot's PID."
|
||||||
return "PID: \x02%s\x02" % os.getpid()
|
return "PID: \x02%s\x02" % os.getpid()
|
||||||
|
|
|
@ -50,7 +50,7 @@ def tellinput(paraml, input=None, notice=None, db=None, bot=None, nick=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)
|
||||||
|
|
||||||
|
@ -72,7 +72,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:
|
||||||
|
|
|
@ -9,7 +9,7 @@ api_url = 'http://api.wolframalpha.com/v2/query?format=plaintext'
|
||||||
|
|
||||||
@hook.command("time")
|
@hook.command("time")
|
||||||
def time_command(inp, bot=None):
|
def time_command(inp, bot=None):
|
||||||
".time <area> -- Gets the time in <area>"
|
"time <area> -- Gets the time in <area>"
|
||||||
|
|
||||||
query = "current time in %s" % inp
|
query = "current time in %s" % inp
|
||||||
|
|
||||||
|
|
|
@ -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) args -- Manipulates your list of todos."
|
"todo (add|del|list|search) 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 <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:
|
||||||
|
|
|
@ -47,7 +47,7 @@ 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>."
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ from util import hook, http
|
||||||
@hook.command('u')
|
@hook.command('u')
|
||||||
@hook.command
|
@hook.command
|
||||||
def urban(inp):
|
def urban(inp):
|
||||||
".urban <phrase> [id] -- Looks up <phrase> on urbandictionary.com."
|
"urban <phrase> [id] -- Looks up <phrase> on urbandictionary.com."
|
||||||
|
|
||||||
# set a default definition number
|
# set a default definition number
|
||||||
id = 1
|
id = 1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from util import hook, http, urlnorm
|
rom util import hook, http, urlnorm
|
||||||
import re
|
import re
|
||||||
|
|
||||||
titler = re.compile(r'(?si)<title>(.+?)</title>')
|
titler = re.compile(r'(?si)<title>(.+?)</title>')
|
||||||
|
@ -32,5 +32,5 @@ def get_title(url):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def title(inp):
|
def title(inp):
|
||||||
".title <url> -- gets the title of a web page"
|
"title <url> -- gets the title of a web page"
|
||||||
return get_title(inp)
|
return get_title(inp)
|
||||||
|
|
|
@ -10,7 +10,7 @@ from util import hook, http
|
||||||
@hook.command('w3c')
|
@hook.command('w3c')
|
||||||
@hook.command
|
@hook.command
|
||||||
def validate(inp):
|
def validate(inp):
|
||||||
".validate <url> -- Runs url through the 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
|
||||||
|
|
|
@ -3,7 +3,7 @@ from util import hook, http
|
||||||
|
|
||||||
@hook.regex(r'vimeo.com/([0-9]+)')
|
@hook.regex(r'vimeo.com/([0-9]+)')
|
||||||
def vimeo_url(match):
|
def vimeo_url(match):
|
||||||
".vimeo <url> -- returns information on the Vimeo video at <url>"
|
"vimeo <url> -- returns information on the Vimeo video at <url>"
|
||||||
info = http.get_json('http://vimeo.com/api/v2/video/%s.json'
|
info = http.get_json('http://vimeo.com/api/v2/video/%s.json'
|
||||||
% match.group(1))
|
% match.group(1))
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ with open("plugins/data/kill_bodyparts.txt") as f:
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def slap(inp, me=None, nick=None, conn=None, notice=None):
|
def slap(inp, me=None, nick=None, conn=None, notice=None):
|
||||||
".slap <user> -- Makes the bot slap <user>."
|
"slap <user> -- Makes the bot slap <user>."
|
||||||
target = inp.lower()
|
target = inp.lower()
|
||||||
|
|
||||||
if not re.match(nick_re, target):
|
if not re.match(nick_re, target):
|
||||||
|
@ -51,7 +51,7 @@ def slap(inp, me=None, nick=None, conn=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def lart(inp, me=None, nick=None, conn=None, notice=None):
|
def lart(inp, me=None, nick=None, conn=None, notice=None):
|
||||||
".lart <user> -- LARTs <user>."
|
"lart <user> -- LARTs <user>."
|
||||||
target = inp.lower()
|
target = inp.lower()
|
||||||
|
|
||||||
if not re.match(nick_re, target):
|
if not re.match(nick_re, target):
|
||||||
|
@ -71,7 +71,7 @@ def lart(inp, me=None, nick=None, conn=None, notice=None):
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def kill(inp, me=None, nick=None, conn=None, notice=None):
|
def kill(inp, me=None, nick=None, conn=None, notice=None):
|
||||||
".kill <user> -- Makes the bot kill <user>."
|
"kill <user> -- Makes the bot kill <user>."
|
||||||
target = inp.lower()
|
target = inp.lower()
|
||||||
|
|
||||||
if not re.match(nick_re, target):
|
if not re.match(nick_re, target):
|
||||||
|
|
|
@ -9,7 +9,7 @@ def fahrenheit_to_celcius(f):
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def forecast(inp, nick='', server='',
|
def forecast(inp, nick='', server='',
|
||||||
reply=None, db=None, notice=None, say=None):
|
reply=None, db=None, notice=None, say=None):
|
||||||
".forecast <location> [dontsave] -- Gets a weather forecast" \
|
"forecast <location> [dontsave] -- Gets a weather forecast" \
|
||||||
" for <location> from Google."
|
" for <location> from Google."
|
||||||
loc = inp
|
loc = inp
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ def forecast(inp, nick='', server='',
|
||||||
|
|
||||||
@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"\
|
"weather <location> [dontsave] -- Gets weather data"\
|
||||||
" for <location> from Google."
|
" for <location> from Google."
|
||||||
loc = inp
|
loc = inp
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,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>"
|
"whois <domain> -- Look up ownership infomation for <domain>"
|
||||||
try:
|
try:
|
||||||
w = pywhois.whois(inp)
|
w = pywhois.whois(inp)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -16,7 +16,7 @@ paren_re = re.compile('\s*\(.*\)$')
|
||||||
@hook.command('w')
|
@hook.command('w')
|
||||||
@hook.command
|
@hook.command
|
||||||
def wiki(inp):
|
def wiki(inp):
|
||||||
".wiki <phrase> -- Gets first sentence of Wikipedia article on <phrase>."
|
"wiki <phrase> -- Gets first sentence of Wikipedia article on <phrase>."
|
||||||
|
|
||||||
x = http.get_xml(search_url, search=inp)
|
x = http.get_xml(search_url, search=inp)
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ from util.text import truncate_words
|
||||||
@hook.command('wa')
|
@hook.command('wa')
|
||||||
@hook.command
|
@hook.command
|
||||||
def wolframalpha(inp, bot=None):
|
def wolframalpha(inp, bot=None):
|
||||||
".wa <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)
|
||||||
bitly_user = bot.config.get("api_keys", {}).get("bitly_user", None)
|
bitly_user = bot.config.get("api_keys", {}).get("bitly_user", None)
|
||||||
|
|
|
@ -5,7 +5,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)
|
||||||
|
|
|
@ -70,7 +70,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