This commit is contained in:
Luke Rogers 2012-03-23 13:00:22 +13:00
parent 8c3bc46343
commit ffbeab7e14
2 changed files with 15 additions and 15 deletions

View file

@ -1,5 +1,4 @@
""" plugin by _303 (?)
pulled from <https://github.com/blha303/skybot/commit/d4ba73d6e3f21cc60a01342f3de9d0d4abd14b3d> by lukeroge
"""
from util import hook
@ -10,6 +9,7 @@ pattern = re.compile(r'^(?P<count>\d+)x (?P<name>.+?): (?P<ingredients>.*)$')
recipelist = []
class Recipe(object):
__slots__ = 'output', 'count', 'ingredients', 'line'
@ -21,7 +21,8 @@ class Recipe(object):
def __str__(self):
return self.line
with open("./plugins/data/recipes.txt") as f:
for line in f.readlines():
if line.startswith("//"):
@ -44,7 +45,8 @@ with open("./plugins/data/itemids.txt") as f:
parts = line.strip().split()
id = parts[0]
name = " ".join(parts[1:])
ids.append((id,name))
ids.append((id, name))
@hook.command
def itemid(input, reply=None):
@ -67,21 +69,21 @@ def itemid(input, reply=None):
if not len(results):
reply("No matches found.")
return
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)
return out
@hook.command("crafting")
@hook.command("craft")
@hook.command
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()
results = []
@ -95,10 +97,9 @@ def recipe(input, reply=None):
return
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:
reply(result)

View file

@ -1,4 +1,3 @@
# mute plugin by lukeroge and neersighted
from util import hook
muted = []
@ -64,7 +63,7 @@ def mute(inp, input=None, db=None):
def unmute(inp, input=None, db=None):
".unmute <channel/user> -- Makes the bot listen to <channel/user>."
target = inp
if is_muted(target):
unmute_target(target)
input.notice("%s has been unmuted." % target)