1+ import codecs
2+ import json
13import random
24import time
35
6+ import os
7+
48from cloudbot import hook
9+ from cloudbot .util .textgen import TextGenerator
510
6- rooms = ["courtyard" , "guest house" , "observatory" , "theatre" , "drawing room" , "garage" , "spa" , "master bedroom" , "studio" , "pool" , "arcade" , "beach house" , "surf shop" , "kitchen" , "ballroom" , "conservatory" , "billiard room" , "library" , "study" , "hallway" , "lounge" , "dining room" , "cellar" ]
7- weapons = ["a candlestick" ,"an axe" , "a pistol" , "rope" , "gloves" , "a horseshoe" , "a knife" , "a baseball bat" , "a chalice" , "a dumbbell" , "a wrench" , "a trophy" , "a pipe" , "garden shears" ]
11+ hookups = {}
812
913bitesyns = ["bites" , "nips" , "nibbles" , "chomps" , "licks" , "teases" , "chews" , "gums" , "tastes" ]
1014bodyparts = ["cheeks" , "ear lobes" , "nipples" , "nose" , "neck" , "toes" , "fingers" , "butt" , "taint" , "thigh" , "grundle" , "tongue" , "calf" , "nurses" , "nape" ]
1317
1418usrcache = []
1519
20+
21+ @hook .on_start
22+ def load_hookups (bot ):
23+ hookups .clear ()
24+ with codecs .open (os .path .join (bot .data_dir , "hookup.json" ), encoding = "utf-8" ) as f :
25+ hookups .update (json .load (f ))
26+
27+
1628@hook .command (autohelp = False )
17- def hookup (db , conn , chan ):
29+ def hookup (db , chan ):
1830 """matches two users from the channel in a sultry scene."""
1931 times = time .time () - 86400
2032 results = db .execute ("select name from seen_user where chan = :chan and time > :time" , {"chan" : chan , "time" : times }).fetchall ()
@@ -24,10 +36,13 @@ def hookup(db, conn, chan):
2436 people = list (set (row [0 ] for row in results ))
2537 random .shuffle (people )
2638 person1 , person2 = people [:2 ]
27- room = random .choice (rooms )
28- weapon = random .choice (weapons )
29- out = "{} used {} and did it with {} in the {}." .format (person1 , weapon , person2 , room )
30- return out
39+ variables = {
40+ 'user1' : person1 ,
41+ 'user2' : person2 ,
42+ }
43+ generator = TextGenerator (hookups ['templates' ], hookups ['parts' ], variables = variables )
44+ return generator .generate_string ()
45+
3146
3247@hook .command (autohelp = False )
3348def bite (text , chan , action ):
@@ -40,6 +55,7 @@ def bite(text, chan, action):
4055 out = "{} {}'s {}." .format (bite , name , body )
4156 action (out , chan )
4257
58+
4359@hook .command (autohelp = False )
4460def glomp (text , chan , action ):
4561 """glomps the specified nick."""
0 commit comments