File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed
Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "parts" : {},
3+ "templates" : [
4+ " {nick} wraps arms around {target} and clings forever" ,
5+ " {nick} gives {target} a BIIIIIIIIG hug!!!" ,
6+ " {nick} gives {target} a warming hug" ,
7+ " {nick} hugs {target} into a coma" ,
8+ " {nick} squeezes {target} to death" ,
9+ " {nick} gives {target} a christian side hug" ,
10+ " {nick} glomps {target}" ,
11+ " {nick} reluctantly hugs {target}..." ,
12+ " {nick} gives {target} a well-deserved hug :)" ,
13+ " {nick} hugs {target}" ,
14+ " {nick} hugs {target} forever and ever and ever" ,
15+ " cant stop, wont stop. {nick} hugs {target} until the sun goes cold" ,
16+ " {nick} rallies up everyone in the channel to give {target} a group hug" ,
17+ " {nick} gives {target} a tight hug and rubs their back" ,
18+ " {nick} hugs {target} and gives their hair a sniff" ,
19+ " {nick} smothers {target} with a loving hug"
20+ ]
21+ }
Original file line number Diff line number Diff line change 1+ import json
2+ from pathlib import Path
3+
4+ from cloudbot import hook
5+ from cloudbot .util .textgen import TextGenerator
6+
7+ hug_data = {}
8+
9+
10+ @hook .on_start
11+ def load_hug (bot ):
12+ hug_data .clear ()
13+ data_file = Path (bot .data_dir ) / "hug.json"
14+ with data_file .open (encoding = 'utf-8' ) as f :
15+ hug_data .update (json .load (f ))
16+
17+
18+ @hook .command ("hug" )
19+ def hug (text , nick , message ):
20+ """hugs <user>"""
21+ data = {
22+ 'nick' : nick ,
23+ 'target' : text ,
24+ }
25+
26+ generator = TextGenerator (hug_data ['templates' ], hug_data ['parts' ], variables = data )
27+ message (generator .generate_string ())
You can’t perform that action at this time.
0 commit comments