diff --git a/data/taco.json b/data/taco.json new file mode 100644 index 000000000..4df3196df --- /dev/null +++ b/data/taco.json @@ -0,0 +1,75 @@ +{ + "templates": [ + "hands {user} a {quality} {type} taco filled with {meat} and topped with {topping}, {topping} and {topping}!" + ], + "parts": { + "type": [ + "hard-shell", + "soft-shell", + "crispy", + "puffy", + "Indian" + ], + "quality": [ + "spicy", + "mild", + "delicious", + [ + "boring", + 1 + ], + [ + "disgusting", + 1 + ], + "perfect" + ], + "meat": [ + "minced beef", + "chicken", + "refried beans" + ], + "topping": [ + [ + "guacamole", + 10 + ], + [ + "salsa", + 10 + ], + [ + "sour cream", + 10 + ], + "cheese", + "lettuce", + "tomatoes", + "avocado", + "onion", + "scallions", + "jalapeƱos", + "capsicum", + [ + "ghost chili", + 1 + ], + [ + "olives", + 1 + ], + [ + "pineapple", + 1 + ], + [ + "raspberry", + 1 + ], + [ + "potato", + 1 + ] + ] + } +} \ No newline at end of file diff --git a/plugins/foods.py b/plugins/foods.py index 4c5d6b63d..fc49b78d4 100644 --- a/plugins/foods.py +++ b/plugins/foods.py @@ -65,11 +65,14 @@ def load_foods(bot): """ :type bot: cloudbot.bot.CloudBot """ - global sandwich_data + global sandwich_data, taco_data with codecs.open(os.path.join(bot.data_dir, "sandwich.json"), encoding="utf-8") as f: sandwich_data = json.load(f) + with codecs.open(os.path.join(bot.data_dir, "taco.json"), encoding="utf-8") as f: + taco_data = json.load(f) + @asyncio.coroutine @hook.command @@ -143,3 +146,18 @@ def sandwich(text, action): # act out the message action(generator.generate_string()) + +@asyncio.coroutine +@hook.command +def taco(text, action): + """ - give a taco to """ + user = text.strip() + + if not is_valid(user): + return "I can't give a taco to that user." + + generator = textgen.TextGenerator(taco_data["templates"], taco_data["parts"], + variables={"user": user}) + + # act out the message + action(generator.generate_string()) \ No newline at end of file