File tree Expand file tree Collapse file tree 2 files changed +94
-1
lines changed
Expand file tree Collapse file tree 2 files changed +94
-1
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "templates" : [
3+ " hands {user} a {quality} {type} taco filled with {meat} and topped with {topping}, {topping} and {topping}!"
4+ ],
5+ "parts" : {
6+ "type" : [
7+ " hard-shell" ,
8+ " soft-shell" ,
9+ " crispy" ,
10+ " puffy" ,
11+ " Indian"
12+ ],
13+ "quality" : [
14+ " spicy" ,
15+ " mild" ,
16+ " delicious" ,
17+ [
18+ " boring" ,
19+ 1
20+ ],
21+ [
22+ " disgusting" ,
23+ 1
24+ ],
25+ " perfect"
26+ ],
27+ "meat" : [
28+ " minced beef" ,
29+ " chicken" ,
30+ " refried beans"
31+ ],
32+ "topping" : [
33+ [
34+ " guacamole" ,
35+ 10
36+ ],
37+ [
38+ " salsa" ,
39+ 10
40+ ],
41+ [
42+ " sour cream" ,
43+ 10
44+ ],
45+ " cheese" ,
46+ " lettuce" ,
47+ " tomatoes" ,
48+ " avocado" ,
49+ " onion" ,
50+ " scallions" ,
51+ " jalapeños" ,
52+ " capsicum" ,
53+ [
54+ " ghost chili" ,
55+ 1
56+ ],
57+ [
58+ " olives" ,
59+ 1
60+ ],
61+ [
62+ " pineapple" ,
63+ 1
64+ ],
65+ [
66+ " raspberry" ,
67+ 1
68+ ],
69+ [
70+ " potato" ,
71+ 1
72+ ]
73+ ]
74+ }
75+ }
Original file line number Diff line number Diff line change @@ -65,11 +65,14 @@ def load_foods(bot):
6565 """
6666 :type bot: cloudbot.bot.CloudBot
6767 """
68- global sandwich_data
68+ global sandwich_data , taco_data
6969
7070 with codecs .open (os .path .join (bot .data_dir , "sandwich.json" ), encoding = "utf-8" ) as f :
7171 sandwich_data = json .load (f )
7272
73+ with codecs .open (os .path .join (bot .data_dir , "taco.json" ), encoding = "utf-8" ) as f :
74+ taco_data = json .load (f )
75+
7376
7477@asyncio .coroutine
7578@hook .command
@@ -143,3 +146,18 @@ def sandwich(text, action):
143146
144147 # act out the message
145148 action (generator .generate_string ())
149+
150+ @asyncio .coroutine
151+ @hook .command
152+ def taco (text , action ):
153+ """<user> - give a taco to <user>"""
154+ user = text .strip ()
155+
156+ if not is_valid (user ):
157+ return "I can't give a taco to that user."
158+
159+ generator = textgen .TextGenerator (taco_data ["templates" ], taco_data ["parts" ],
160+ variables = {"user" : user })
161+
162+ # act out the message
163+ action (generator .generate_string ())
You can’t perform that action at this time.
0 commit comments