Skip to content

Commit 194f1e1

Browse files
committed
Move foaas data to a data file
1 parent 48a082b commit 194f1e1

2 files changed

Lines changed: 94 additions & 70 deletions

File tree

data/foaas.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"fuck_offs": [
3+
"donut",
4+
"bus",
5+
"chainsaw",
6+
"king",
7+
"madison",
8+
"gfy",
9+
"back",
10+
"keep",
11+
"name",
12+
"bday",
13+
"dalton",
14+
"ing",
15+
"nugget",
16+
"outside",
17+
"off",
18+
"problem",
19+
"shakespeare",
20+
"think",
21+
"thinking",
22+
"xmas",
23+
"yoda",
24+
"you"
25+
],
26+
"single_fucks": [
27+
"bag",
28+
"awesome",
29+
"because",
30+
"bucket",
31+
"bye",
32+
"cool",
33+
"everyone",
34+
"everything",
35+
"flying",
36+
"give",
37+
"horse",
38+
"life",
39+
"looking",
40+
"maybe",
41+
"me",
42+
"mornin",
43+
"no",
44+
"pink",
45+
"retard",
46+
"rtfm",
47+
"sake",
48+
"shit",
49+
"single",
50+
"thanks",
51+
"that",
52+
"this",
53+
"too",
54+
"tucker",
55+
"zayn",
56+
"zero"
57+
]
58+
}

plugins/foaas.py

Lines changed: 36 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,45 @@
1-
import requests
1+
import json
22
import random
3+
from pathlib import Path
4+
5+
import requests
6+
37
from cloudbot import hook
48

5-
FuckOffList = [
6-
'donut',
7-
'bus',
8-
'chainsaw',
9-
'king',
10-
'madison',
11-
'gfy',
12-
'back',
13-
'keep',
14-
'name',
15-
'bday',
16-
'dalton',
17-
'ing',
18-
'nugget',
19-
'outside',
20-
'off',
21-
'problem',
22-
'shakespeare',
23-
'think',
24-
'thinking',
25-
'xmas',
26-
'yoda',
27-
'you'
28-
]
9+
BASE_URL = "http://www.foaas.com/{fuck}/{target}"
10+
11+
headers = {'Accept': 'text/plain'}
12+
13+
fuck_offs = {}
2914

30-
SingleFuckList = [
31-
'bag',
32-
'awesome',
33-
'because',
34-
'bucket',
35-
'bye',
36-
'cool',
37-
'everyone',
38-
'everything',
39-
'flying',
40-
'give',
41-
'horse',
42-
'life',
43-
'looking',
44-
'maybe',
45-
'me',
46-
'mornin',
47-
'no',
48-
'pink',
49-
'retard',
50-
'rtfm',
51-
'sake',
52-
'shit',
53-
'single',
54-
'thanks',
55-
'that',
56-
'this',
57-
'too',
58-
'tucker',
59-
'zayn',
60-
'zero'
15+
16+
def format_url(fucker, fuckee=None):
17+
if fuckee:
18+
fucks = fuck_offs['fuck_offs']
19+
target = "\2{fuckee}\2/{fucker}".format(fuckee=fuckee, fucker=fucker)
20+
else:
21+
fucks = fuck_offs['single_fucks']
22+
target = fucker
23+
24+
return BASE_URL.format(fuck=random.choice(fucks), target=target)
6125

6226

63-
]
27+
def get_fuck_off(fucker, fuckee):
28+
url = format_url(fucker, fuckee)
29+
r = requests.get(url, headers=headers)
30+
return r.text
6431

65-
headers = {'Accept' : 'text/plain'}
6632

67-
@hook.command('fos','fuckoff','foaas', autohelp = False)
33+
@hook.on_start
34+
def load_fuck_offs(bot):
35+
fuck_offs.clear()
36+
data_file = Path(bot.data_dir) / "foaas.json"
37+
with data_file.open(encoding='utf-8') as f:
38+
fuck_offs.update(json.load(f))
39+
40+
41+
@hook.command('fos', 'fuckoff', 'foaas', autohelp=False)
6842
def foaas(text, nick, message):
69-
'''fos [name] to tell some one to fuck off or just .fos for a generic fuckoff'''
70-
Fuckee = text.strip()
71-
Fucker = nick
72-
if Fuckee == '':
73-
r = requests.get('http://www.foaas.com/' + str(random.choice(SingleFuckList)) + '/' + Fucker,headers=headers)
74-
out = r.text
75-
message(out)
76-
else:
77-
r = requests.get('http://www.foaas.com/' + str(random.choice(FuckOffList)) + '/' + "\x02" + Fuckee + "\x02" + '/' + Fucker, headers=headers)
78-
out = r.text
79-
message(out)
43+
"""fos [name] to tell some one to fuck off or just .fos for a generic fuckoff"""
44+
out = get_fuck_off(nick, text)
45+
message(out)

0 commit comments

Comments
 (0)