Skip to content

Commit 5d74e48

Browse files
committed
Merge branch 'gonzobot' of github.com:snoonetIRC/CloudBot into gonzobot
2 parents 6f9e3bc + 5dd1722 commit 5d74e48

3 files changed

Lines changed: 46 additions & 2 deletions

File tree

data/rice.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"templates": [
3+
"hands {user} a bowl of {rice} rice."
4+
],
5+
"parts": {
6+
"rice": [
7+
"Uncle Ben's Basmati",
8+
"Uncle Ben's Golden Vegetable ",
9+
"Japanese Koshihikari",
10+
"Camargue red",
11+
"Brown",
12+
"Wehani",
13+
"Jasmine",
14+
"Sticky",
15+
"Hokkien fried",
16+
"Bibimbap",
17+
"Dal bhat",
18+
"Onigiri",
19+
"Long-grain Nychaki",
20+
"Iranian Domsiah",
21+
"Italian Vialone Nano",
22+
"Nàng Thơm Chợ Đào",
23+
"Htamanè",
24+
"Aromic Tulaipanji"
25+
]
26+
}
27+
}

plugins/foods.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def load_foods(bot):
6565
"""
6666
:type bot: cloudbot.bot.CloudBot
6767
"""
68-
global sandwich_data, taco_data, coffee_data, noodles_data, muffin_data, scone_data, \
68+
global sandwich_data, taco_data, coffee_data, noodles_data, muffin_data, scone_data, rice_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, \
7171
nugget_data, cereal_data, pie_data, sushi_data, steak_data, milkshake_data, kebab_data
@@ -88,6 +88,9 @@ def load_foods(bot):
8888
with codecs.open(os.path.join(bot.data_dir, "scone.json"), encoding="utf-8") as f:
8989
scone_data = json.load(f)
9090

91+
with codecs.open(os.path.join(bot.data_dir, "rice.json"), encoding="utf-8") as f:
92+
rice_data = json.load(f)
93+
9194
with codecs.open(os.path.join(bot.data_dir, "tea.json"), encoding="utf-8") as f:
9295
tea_data = json.load(f)
9396

@@ -291,6 +294,20 @@ def scone(text, action):
291294
# act out the message
292295
action(generator.generate_string())
293296

297+
@asyncio.coroutine
298+
@hook.command
299+
def rice(text, action):
300+
"""<user> - give rice to <user>"""
301+
user = text.strip()
302+
303+
if not is_valid(user):
304+
return "I can't give rice to that user."
305+
306+
generator = textgen.TextGenerator(rice_data["templates"], rice_data["parts"],
307+
variables={"user": user})
308+
# act out the message
309+
action(generator.generate_string())
310+
294311
@asyncio.coroutine
295312
@hook.command
296313
def tea(text, action):

plugins/link_announcer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from cloudbot import hook
66

77
# This will match any URL except the patterns defined in blacklist.
8-
blacklist = '.*(reddit\.com|redd\.it|youtube\.com|youtu\.be|imdb\.com|spotify\.com|twitter\.com|twitch\.tv|amazon\.co|xkcd\.com|amzn\.co|steamcommunity\.com|steampowered\.com|newegg\.com|soundcloud\.com|vimeo\.com).*'
8+
blacklist = '.*(reddit\.com|redd\.it|youtube\.com|youtu\.be|imdb\.com|spotify\.com|twitter\.com|twitch\.tv|amazon\.co|xkcd\.com|amzn\.co|steamcommunity\.com|steampowered\.com|newegg\.com|soundcloud\.com|vimeo\.com|speedtest\.net).*'
99
url_re = re.compile('(?!{})http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+~]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'.format(blacklist), re.I)
1010

1111
opt_out = []

0 commit comments

Comments
 (0)