11import codecs
22import json
3+ import os
34import random
45import time
56
6- import os
7-
87from cloudbot import hook
98from cloudbot .util .textgen import TextGenerator
109
1110hookups = {}
12-
13- bitesyns = ["bites" , "nips" , "nibbles" , "chomps" , "licks" , "teases" , "chews" , "gums" , "tastes" ]
14- bodyparts = ["cheeks" , "ear lobes" , "nipples" , "nose" , "neck" , "toes" , "fingers" , "butt" , "taint" , "thigh" , "grundle" , "tongue" , "calf" , "nurses" , "nape" ]
15-
11+ bites = {}
1612glomps = []
1713
1814
1915@hook .on_start
2016def load_data (bot ):
2117 hookups .clear ()
2218 glomps .clear ()
19+ bites .clear ()
2320
2421 with codecs .open (os .path .join (bot .data_dir , "hookup.json" ), encoding = "utf-8" ) as f :
2522 hookups .update (json .load (f ))
@@ -28,6 +25,9 @@ def load_data(bot):
2825 lines = (line .strip () for line in f if not line .startswith ("//" ))
2926 glomps .extend (filter (None , lines ))
3027
28+ with codecs .open (os .path .join (bot .data_dir , "bite.json" ), encoding = "utf-8" ) as f :
29+ bites .update (json .load (f ))
30+
3131
3232@hook .command (autohelp = False )
3333def hookup (db , chan ):
@@ -54,10 +54,8 @@ def bite(text, chan, action):
5454 if not text :
5555 return "please tell me who to bite."
5656 name = text .split (' ' )[0 ]
57- bite = random .choice (bitesyns )
58- body = random .choice (bodyparts )
59- out = "{} {}'s {}." .format (bite , name , body )
60- action (out , chan )
57+ generator = TextGenerator (bites ['templates' ], bites ['parts' ], variables = {'user' : name })
58+ action (generator .generate_string (), chan )
6159
6260
6361@hook .command (autohelp = False )
0 commit comments