|
10 | 10 |
|
11 | 11 | nick_re = re.compile("^[A-Za-z0-9_|.\-\]\[\{\}\*\`]*$", re.I) |
12 | 12 |
|
13 | | -cookies = ['Chocolate Chip', 'Oatmeal', 'Sugar', 'Oatmeal Raisin', 'Macadamia Nut', 'Jam Thumbprint', 'Mexican Wedding', |
14 | | - 'Biscotti', 'Oatmeal Cranberry', 'Chocolate Fudge', 'Peanut Butter', 'Pumpkin', 'Lemon Bar', |
15 | | - 'Chocolate Oatmeal Fudge', 'Toffee Peanut', 'Danish Sugar', 'Triple Chocolate', 'Oreo'] |
16 | | - |
17 | | - |
18 | 13 | sandwich_data = {} |
19 | 14 | taco_data = {} |
20 | 15 | coffee_data = {} |
|
43 | 38 | kebab_data = {} |
44 | 39 | cake_data = {} |
45 | 40 | potato_data = {} |
| 41 | +cookie_data = {} |
46 | 42 |
|
47 | 43 |
|
48 | 44 | def is_valid(target): |
@@ -93,6 +89,7 @@ def load_foods(bot): |
93 | 89 | load_template_data(bot, "kebab.json", kebab_data) |
94 | 90 | load_template_data(bot, "cake.json", cake_data) |
95 | 91 | load_template_data(bot, "potato.json", potato_data) |
| 92 | + load_template_data(bot, "cookies.json", cookie_data) |
96 | 93 |
|
97 | 94 |
|
98 | 95 | @asyncio.coroutine |
@@ -142,14 +139,12 @@ def cookie(text, action): |
142 | 139 | if not is_valid(user): |
143 | 140 | return "I can't give a cookie to that user." |
144 | 141 |
|
145 | | - cookie_type = random.choice(cookies) |
146 | | - size = random.choice(['small', 'little', 'medium-sized', 'large', 'gigantic']) |
147 | | - flavor = random.choice(['tasty', 'delectable', 'delicious', 'yummy', 'toothsome', 'scrumptious', 'luscious']) |
148 | | - method = random.choice(['makes', 'gives', 'gets', 'buys']) |
149 | | - side_dish = random.choice(['glass of milk', 'bowl of ice cream', 'bowl of chocolate sauce']) |
| 142 | + generator = textgen.TextGenerator( |
| 143 | + cookie_data["templates"], cookie_data["parts"], variables={"user": user} |
| 144 | + ) |
150 | 145 |
|
151 | | - action("{} {} a {} {} {} cookie and serves it with a {}!".format(method, user, flavor, size, cookie_type, |
152 | | - side_dish)) |
| 146 | + # act out the message |
| 147 | + action(generator.generate_string()) |
153 | 148 |
|
154 | 149 |
|
155 | 150 | @asyncio.coroutine |
|
0 commit comments