File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """
2+ wyr.py
3+
4+ A plugin that uses the RRRather.com API to return random "Would you rather" questions.
5+
6+ Created By:
7+ - Foxlet <https://github.com/foxlet>
8+ - Luke Rogers <https://github.com/lukeroge>
9+
10+ Special Thanks:
11+ - http://www.rrrather.com/ for adding extra features to their API to make this command possible
12+
13+ License:
14+ GPL v3
15+ """
16+
117import requests
218
319from cloudbot import hook
723
824
925def get_wyr (headers ):
26+ """ Gets a entry from the RRRather API and cleans up the data """
1027 r = requests .get (url = API_URL , headers = headers )
1128 data = r .json ()
1229
@@ -23,10 +40,12 @@ def get_wyr(headers):
2340 return data
2441
2542
26- @hook .command ("wyr" , "wouldyourather" )
43+ @hook .command ("wyr" , "wouldyourather" , autohelp = False )
2744def wyr (bot ):
45+ """ -- What would you rather do? """
2846 headers = {"User-Agent" : bot .user_agent }
2947
48+ # keep trying to get entries until we find one that is not filtered
3049 while True :
3150 data = get_wyr (headers )
3251
@@ -42,7 +61,6 @@ def wyr(bot):
4261 title_text = data ['title' ].split ()
4362
4463 dupl_count = 0
45-
4664 for word in title_text :
4765 dupl_count += text .count (word )
4866
You can’t perform that action at this time.
0 commit comments