PEP-8
This commit is contained in:
parent
8c3bc46343
commit
ffbeab7e14
2 changed files with 15 additions and 15 deletions
|
@ -1,5 +1,4 @@
|
||||||
""" plugin by _303 (?)
|
""" plugin by _303 (?)
|
||||||
pulled from <https://github.com/blha303/skybot/commit/d4ba73d6e3f21cc60a01342f3de9d0d4abd14b3d> by lukeroge
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from util import hook
|
from util import hook
|
||||||
|
@ -10,6 +9,7 @@ pattern = re.compile(r'^(?P<count>\d+)x (?P<name>.+?): (?P<ingredients>.*)$')
|
||||||
|
|
||||||
recipelist = []
|
recipelist = []
|
||||||
|
|
||||||
|
|
||||||
class Recipe(object):
|
class Recipe(object):
|
||||||
__slots__ = 'output', 'count', 'ingredients', 'line'
|
__slots__ = 'output', 'count', 'ingredients', 'line'
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@ class Recipe(object):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.line
|
return self.line
|
||||||
|
|
||||||
|
|
||||||
with open("./plugins/data/recipes.txt") as f:
|
with open("./plugins/data/recipes.txt") as f:
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
if line.startswith("//"):
|
if line.startswith("//"):
|
||||||
|
@ -44,7 +45,8 @@ with open("./plugins/data/itemids.txt") as f:
|
||||||
parts = line.strip().split()
|
parts = line.strip().split()
|
||||||
id = parts[0]
|
id = parts[0]
|
||||||
name = " ".join(parts[1:])
|
name = " ".join(parts[1:])
|
||||||
ids.append((id,name))
|
ids.append((id, name))
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def itemid(input, reply=None):
|
def itemid(input, reply=None):
|
||||||
|
@ -67,21 +69,21 @@ def itemid(input, reply=None):
|
||||||
if not len(results):
|
if not len(results):
|
||||||
reply("No matches found.")
|
reply("No matches found.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(results) > 12:
|
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
|
return
|
||||||
|
|
||||||
out = ", ".join(results)
|
out = ", ".join(results)
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@hook.command("crafting")
|
@hook.command("craft")
|
||||||
@hook.command
|
@hook.command
|
||||||
def recipe(input, reply=None):
|
def recipe(input, reply=None):
|
||||||
".recipe <item> -- gets the crafting recipe for an item"
|
".recipe/.craft <item> -- gets the crafting recipe for an item"
|
||||||
input = input.lower().strip()
|
input = input.lower().strip()
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
@ -95,10 +97,9 @@ def recipe(input, reply=None):
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(results) > 3:
|
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
|
return
|
||||||
|
|
||||||
for result in results:
|
for result in results:
|
||||||
reply(result)
|
reply(result)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# mute plugin by lukeroge and neersighted
|
|
||||||
from util import hook
|
from util import hook
|
||||||
|
|
||||||
muted = []
|
muted = []
|
||||||
|
@ -64,7 +63,7 @@ def mute(inp, input=None, db=None):
|
||||||
def unmute(inp, input=None, db=None):
|
def unmute(inp, input=None, db=None):
|
||||||
".unmute <channel/user> -- Makes the bot listen to <channel/user>."
|
".unmute <channel/user> -- Makes the bot listen to <channel/user>."
|
||||||
target = inp
|
target = inp
|
||||||
|
|
||||||
if is_muted(target):
|
if is_muted(target):
|
||||||
unmute_target(target)
|
unmute_target(target)
|
||||||
input.notice("%s has been unmuted." % target)
|
input.notice("%s has been unmuted." % target)
|
||||||
|
|
Reference in a new issue