Skip to content

Commit 8f1d2e3

Browse files
author
A_D
committed
Merge branch 'gonzobot' of github.com:edwardslabs/CloudBot into gonzobot
2 parents a651e59 + 33a5451 commit 8f1d2e3

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

data/kebab.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"templates": [
3+
"hands {user} a delicious {kebab} with {side} and {sauce}"
4+
],
5+
"parts": {
6+
"kebab": [
7+
"lamb doner kebab",
8+
"chicken doner kebab",
9+
"shawarma"
10+
],
11+
"side": [
12+
"salad",
13+
"fries"
14+
],
15+
"sauce": [
16+
"garlic sauce",
17+
"chili sauce",
18+
"mayonnaise",
19+
"ketchup",
20+
"BBQ sauce",
21+
"mint sauce",
22+
"tzatziki sauce",
23+
"no sauce"
24+
]
25+
}
26+
}

plugins/foods.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from cloudbot import hook
99
from cloudbot.util import textgen
1010

11-
nick_re = re.compile("^[A-Za-z0-9_|.\-\]\[\{\}\*]*$", re.I)
11+
nick_re = re.compile("^[A-Za-z0-9_|.\-\]\[\{\}\*\`]*$", re.I)
1212

1313
cakes = ['Chocolate', 'Ice Cream', 'Angel', 'Boston Cream', 'Birthday', 'Bundt', 'Carrot', 'Coffee', 'Devils', 'Fruit',
1414
'Gingerbread', 'Pound', 'Red Velvet', 'Stack', 'Welsh', 'Yokan']
@@ -68,7 +68,7 @@ def load_foods(bot):
6868
global sandwich_data, taco_data, coffee_data, noodles_data, muffin_data, scone_data, \
6969
tea_data, keto_data, beer_data, cheese_data, pancake_data, chicken_data, \
7070
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
7272

7373
with codecs.open(os.path.join(bot.data_dir, "sandwich.json"), encoding="utf-8") as f:
7474
sandwich_data = json.load(f)
@@ -141,6 +141,9 @@ def load_foods(bot):
141141

142142
with codecs.open(os.path.join(bot.data_dir, "milkshake.json"), encoding="utf-8") as f:
143143
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)
144147

145148
@asyncio.coroutine
146149
@hook.command
@@ -539,3 +542,17 @@ def milkshake(text, action):
539542

540543
# act out the message
541544
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

Comments
 (0)