Fixed formatting and removed unused imports.
This commit is contained in:
parent
fb62640ccc
commit
fa97d4659c
|
@ -1,14 +1,14 @@
|
|||
import re
|
||||
|
||||
from util import hook, text
|
||||
from util import hook
|
||||
from fnmatch import fnmatch
|
||||
|
||||
|
||||
@hook.sieve
|
||||
def sieve_suite(bot, input, func, kind, args):
|
||||
if input.command == 'PRIVMSG' and\
|
||||
input.nick.endswith('bot') and args.get('ignorebots', True):
|
||||
return None
|
||||
if input.command == 'PRIVMSG' and \
|
||||
input.nick.endswith('bot') and args.get('ignorebots', True):
|
||||
return None
|
||||
|
||||
if kind == "command":
|
||||
if input.trigger in bot.config.get('disabled_commands', []):
|
||||
|
@ -34,7 +34,6 @@ def sieve_suite(bot, input, func, kind, args):
|
|||
if args.get('adminonly', False):
|
||||
args["permissions"] = ["adminonly"]
|
||||
|
||||
|
||||
if args.get('permissions', False):
|
||||
groups = bot.config.get("permissions", [])
|
||||
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
from util import hook
|
||||
import re
|
||||
|
||||
|
||||
@hook.regex(r'^(s|S)/.*/.*/\S*$')
|
||||
def correction(inp, say=None, input=None, notice=None, db=None):
|
||||
|
||||
def correction(inp, say=None, notice=None, db=None):
|
||||
splitinput = input.msg.split("/")
|
||||
if splitinput[3]:
|
||||
nick = splitinput[3]
|
||||
else:
|
||||
nick = input.nick
|
||||
last_message = db.execute("select name, quote from seen_user where name"
|
||||
" like ? and chan = ?", (nick.lower(), input.chan.lower())).fetchone()
|
||||
" like ? and chan = ?", (nick.lower(), input.chan.lower())).fetchone()
|
||||
|
||||
if last_message:
|
||||
splitinput = input.msg.split("/")
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from util import hook, http, web
|
||||
from urllib import urlencode
|
||||
from spotify import spotifyfunc as spotify
|
||||
|
||||
url = "http://search.azlyrics.com/search.php?q="
|
||||
|
@ -43,6 +42,7 @@ def lyrics(inp):
|
|||
lyricsum = " / ".join(lyricsum.strip().split("\r\n")[0:4]) # truncate, format
|
||||
else:
|
||||
lyricsum = " / ".join(lyricsum.strip().split("\n")[0:4]) # truncate, format
|
||||
return "\x02%s\x02 by \x02%s\x02 %s%s%s - %s" % (title, artist, web.try_isgd(link), spurl, pasteurl, lyricsum[:-3])
|
||||
return "\x02%s\x02 by \x02%s\x02 %s%s%s - %s" % (
|
||||
title, artist, web.try_isgd(link), spurl, pasteurl, lyricsum[:-3])
|
||||
else:
|
||||
return "No song results. " + url + inp.replace(" ", "+")
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
from util import hook
|
||||
import re
|
||||
import itertools
|
||||
|
||||
pattern = re.compile(r'^(?P<count>\d+)x (?P<name>.+?): (?P<ingredients>.*)$')
|
||||
|
||||
|
@ -32,9 +31,9 @@ with open("plugins/data/recipes.txt") as f:
|
|||
if not match:
|
||||
continue
|
||||
recipelist.append(Recipe(line=line,
|
||||
output=match.group("name").lower(),
|
||||
ingredients=match.group("ingredients"),
|
||||
count=match.group("count")))
|
||||
output=match.group("name").lower(),
|
||||
ingredients=match.group("ingredients"),
|
||||
count=match.group("count")))
|
||||
|
||||
ids = []
|
||||
|
||||
|
@ -51,7 +50,7 @@ with open("plugins/data/itemids.txt") as f:
|
|||
@hook.command("mcid")
|
||||
@hook.command
|
||||
def mcitem(input, reply=None):
|
||||
"mcitem <item/id> -- gets the id from an item or vice versa"
|
||||
"""mcitem <item/id> -- gets the id from an item or vice versa"""
|
||||
input = input.lower().strip()
|
||||
|
||||
if input == "":
|
||||
|
@ -71,8 +70,7 @@ def mcitem(input, reply=None):
|
|||
return "No matches found."
|
||||
|
||||
if len(results) > 12:
|
||||
reply("There are too many options, please narrow your search. " \
|
||||
"(%s)" % len(results))
|
||||
reply("There are too many options, please narrow your search. (%s)" % len(results))
|
||||
return
|
||||
|
||||
out = ", ".join(results)
|
||||
|
@ -83,7 +81,7 @@ def mcitem(input, reply=None):
|
|||
@hook.command("mccraft")
|
||||
@hook.command
|
||||
def mcrecipe(input, reply=None):
|
||||
"mcrecipe <item> -- gets the crafting recipe for an item"
|
||||
"""mcrecipe <item> -- gets the crafting recipe for an item"""
|
||||
input = input.lower().strip()
|
||||
|
||||
results = [recipe.line for recipe in recipelist
|
||||
|
@ -93,8 +91,7 @@ def mcrecipe(input, reply=None):
|
|||
return "No matches found."
|
||||
|
||||
if len(results) > 3:
|
||||
reply("There are too many options, please narrow your search. " \
|
||||
"(%s)" % len(results))
|
||||
reply("There are too many options, please narrow your search. (%s)" % len(results))
|
||||
return
|
||||
|
||||
for result in results:
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
from util import hook, http
|
||||
from util import hook
|
||||
import socket
|
||||
import struct
|
||||
|
||||
try:
|
||||
import DNS
|
||||
import DNS
|
||||
# Please remember to install the dependancy 'pydns'
|
||||
pydns_installed = True
|
||||
except ImportError:
|
||||
pydns_installed = False
|
||||
|
||||
|
||||
def format_motd(motd):
|
||||
empty = ""
|
||||
colors = [u"\x0300,\xa7f", u"\x0301,\xa70", u"\x0302,\xa71", u"\x0303,\xa72", u"\x0304,\xa7c", u"\x0305,\xa74", u"\x0306,\xa75", u"\x0307,\xa76", u"\x0308,\xa7e", u"\x0309,\xa7a", u"\x0310,\xa73", u"\x0311,\xa7b", u"\x0312,\xa71", u"\x0313,\xa7d", u"\x0314,\xa78", u"\x0315,\xa77", u"\x02,\xa7l", u"\x0310,\xa79", u"\x09,\xa7o", u"\x13,\xa7m", u"\x0f,\xa7r", u"\x15,\xa7n"];
|
||||
colors = [u"\x0300,\xa7f", u"\x0301,\xa70", u"\x0302,\xa71", u"\x0303,\xa72", u"\x0304,\xa7c", u"\x0305,\xa74",
|
||||
u"\x0306,\xa75", u"\x0307,\xa76", u"\x0308,\xa7e", u"\x0309,\xa7a", u"\x0310,\xa73", u"\x0311,\xa7b",
|
||||
u"\x0312,\xa71", u"\x0313,\xa7d", u"\x0314,\xa78", u"\x0315,\xa77", u"\x02,\xa7l", u"\x0310,\xa79",
|
||||
u"\x09,\xa7o", u"\x13,\xa7m", u"\x0f,\xa7r", u"\x15,\xa7n"];
|
||||
for s in colors:
|
||||
lcol = s.split(",")
|
||||
motd = motd.replace(lcol[1], lcol[0])
|
||||
|
@ -46,8 +50,8 @@ def mcping_connect(host, port):
|
|||
return message
|
||||
|
||||
except:
|
||||
return "Error pinging " + host + ":" + str(port) +\
|
||||
", is it up? Double-check your address!"
|
||||
return "Error pinging " + host + ":" + str(port) + \
|
||||
", is it up? Double-check your address!"
|
||||
|
||||
|
||||
def srvData(domain):
|
||||
|
@ -57,13 +61,13 @@ def srvData(domain):
|
|||
|
||||
for getsrv in srv_result.answers:
|
||||
if getsrv['typename'] == 'SRV':
|
||||
data = [getsrv['data'][2],getsrv['data'][3]]
|
||||
data = [getsrv['data'][2], getsrv['data'][3]]
|
||||
return data
|
||||
|
||||
|
||||
@hook.command
|
||||
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]
|
||||
|
||||
if ":" in inp:
|
||||
|
@ -86,7 +90,7 @@ def mcping(inp):
|
|||
host = str(getdata[1])
|
||||
port = int(getdata[0])
|
||||
return format_motd(mcping_connect(host, port))
|
||||
except:
|
||||
except:
|
||||
return "Error pinging %s, is it up? Double-check your address!" % inp
|
||||
else:
|
||||
return "Error pinging %s, is it up? Double-check your address!" % inp
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import re
|
||||
|
||||
from util import hook, http
|
||||
from util import hook
|
||||
from util.execute import eval_py
|
||||
|
||||
|
||||
@hook.command
|
||||
def python(inp):
|
||||
"python <prog> -- Executes <prog> as Python code."
|
||||
"""python <prog> -- Executes <prog> as Python code."""
|
||||
|
||||
return eval_py(inp)
|
||||
|
|
Reference in a new issue