|
8 | 8 | from cloudbot import hook |
9 | 9 | from cloudbot.util import textgen |
10 | 10 |
|
11 | | -nick_re = re.compile("^[A-Za-z0-9_|.\-\]\[\{\}\*]*$", re.I) |
| 11 | +nick_re = re.compile("^[A-Za-z0-9_|.\-\]\[\{\}\*\`]*$", re.I) |
12 | 12 |
|
13 | 13 | cakes = ['Chocolate', 'Ice Cream', 'Angel', 'Boston Cream', 'Birthday', 'Bundt', 'Carrot', 'Coffee', 'Devils', 'Fruit', |
14 | 14 | 'Gingerbread', 'Pound', 'Red Velvet', 'Stack', 'Welsh', 'Yokan'] |
@@ -68,7 +68,7 @@ def load_foods(bot): |
68 | 68 | global sandwich_data, taco_data, coffee_data, noodles_data, muffin_data, scone_data, \ |
69 | 69 | tea_data, keto_data, beer_data, cheese_data, pancake_data, chicken_data, \ |
70 | 70 | icecream_data, brekkie_data, doobie_data, pizza_data, chocolate_data, pasta_data, \ |
71 | | - nugget_data, cereal_data, pie_data, sushi_data, steak_data, milkshake_data |
| 71 | + nugget_data, cereal_data, pie_data, sushi_data, steak_data, milkshake_data, kebab_data |
72 | 72 |
|
73 | 73 | with codecs.open(os.path.join(bot.data_dir, "sandwich.json"), encoding="utf-8") as f: |
74 | 74 | sandwich_data = json.load(f) |
@@ -141,6 +141,9 @@ def load_foods(bot): |
141 | 141 |
|
142 | 142 | with codecs.open(os.path.join(bot.data_dir, "milkshake.json"), encoding="utf-8") as f: |
143 | 143 | milkshake_data = json.load(f) |
| 144 | + |
| 145 | + with codecs.open(os.path.join(bot.data_dir, "kebab.json"), encoding="utf-8") as f: |
| 146 | + kebab_data = json.load(f) |
144 | 147 |
|
145 | 148 | @asyncio.coroutine |
146 | 149 | @hook.command |
@@ -539,3 +542,17 @@ def milkshake(text, action): |
539 | 542 |
|
540 | 543 | # act out the message |
541 | 544 | action(generator.generate_string()) |
| 545 | + |
| 546 | +@asyncio.coroutine |
| 547 | +@hook.command |
| 548 | +def kebab(text, action): |
| 549 | + """<user> - give a kebab to <user>""" |
| 550 | + user = text.strip() |
| 551 | + |
| 552 | + if not is_valid(user): |
| 553 | + return "I can't treat that user to a delicious kebab." |
| 554 | + |
| 555 | + generator = textgen.TextGenerator(kebab_data["templates"], kebab_data["parts"], variables={"user": user}) |
| 556 | + |
| 557 | + # act out the message |
| 558 | + action(generator.generate_string()) |
0 commit comments