|
10 | 10 |
|
11 | 11 | nick_re = re.compile("^[A-Za-z0-9_|.\-\]\[\{\}\*\`]*$", re.I) |
12 | 12 |
|
13 | | -cakes = ['Chocolate', 'Ice Cream', 'Angel', 'Boston Cream', 'Birthday', 'Bundt', 'Carrot', 'Coffee', 'Devils', 'Fruit', |
14 | | - 'Gingerbread', 'Pound', 'Red Velvet', 'Stack', 'Welsh', 'Yokan'] |
15 | | - |
16 | 13 | cookies = ['Chocolate Chip', 'Oatmeal', 'Sugar', 'Oatmeal Raisin', 'Macadamia Nut', 'Jam Thumbprint', 'Mexican Wedding', |
17 | 14 | 'Biscotti', 'Oatmeal Cranberry', 'Chocolate Fudge', 'Peanut Butter', 'Pumpkin', 'Lemon Bar', |
18 | 15 | 'Chocolate Oatmeal Fudge', 'Toffee Peanut', 'Danish Sugar', 'Triple Chocolate', 'Oreo'] |
|
79 | 76 | steak_data = {} |
80 | 77 | milkshake_data = {} |
81 | 78 | kebab_data = {} |
| 79 | +cake_data = {} |
82 | 80 |
|
83 | 81 |
|
84 | 82 | def is_valid(target): |
@@ -127,6 +125,7 @@ def load_foods(bot): |
127 | 125 | load_template_data(bot, "steak.json", steak_data) |
128 | 126 | load_template_data(bot, "milkshake.json", milkshake_data) |
129 | 127 | load_template_data(bot, "kebab.json", kebab_data) |
| 128 | + load_template_data(bot, "cake.json", cake_data) |
130 | 129 |
|
131 | 130 |
|
132 | 131 | @asyncio.coroutine |
@@ -157,15 +156,12 @@ def cake(text, action): |
157 | 156 | if not is_valid(user): |
158 | 157 | return "I can't give a cake to that user." |
159 | 158 |
|
160 | | - cake_type = random.choice(cakes) |
161 | | - size = random.choice(['small', 'little', 'mid-sized', 'medium-sized', 'large', 'gigantic']) |
162 | | - flavor = random.choice(['tasty', 'delectable', 'delicious', 'yummy', 'toothsome', 'scrumptious', 'luscious']) |
163 | | - method = random.choice(['makes', 'gives', 'gets', 'buys']) |
164 | | - side_dish = random.choice(['glass of chocolate milk', 'bowl of ice cream', 'jar of cookies', |
165 | | - 'side of chocolate sauce']) |
| 159 | + generator = textgen.TextGenerator( |
| 160 | + cake_data["templates"], cake_data["parts"], variables={"user": user} |
| 161 | + ) |
166 | 162 |
|
167 | | - action("{} {} a {} {} {} cake and serves it with a small {}!".format(method, user, flavor, size, cake_type, |
168 | | - side_dish)) |
| 163 | + # act out the message |
| 164 | + action(generator.generate_string()) |
169 | 165 |
|
170 | 166 |
|
171 | 167 | @asyncio.coroutine |
|
0 commit comments