@@ -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
296313def tea (text , action ):
0 commit comments