Skip to content

Commit e010ac3

Browse files
committed
Add licensing header
1 parent e7beb80 commit e010ac3

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

plugins/wyr.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
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+
117
import requests
218

319
from cloudbot import hook
@@ -7,6 +23,7 @@
723

824

925
def 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)
2744
def 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

0 commit comments

Comments
 (0)