pepepepep8
This commit is contained in:
parent
cd5ae1d32b
commit
223bef30a5
5 changed files with 8 additions and 13 deletions
|
@ -8,9 +8,9 @@ def refresh_cache():
|
|||
soup = http.get_soup('http://www.fmylife.com/random/')
|
||||
|
||||
for e in soup.find_all('div', {'class': 'post article'}):
|
||||
id = int(e['id'])
|
||||
fml_id = int(e['id'])
|
||||
text = ''.join(e.find('p').find_all(text=True))
|
||||
fml_cache.append((id, text))
|
||||
fml_cache.append((fml_id, text))
|
||||
|
||||
# do an initial refresh of the cache
|
||||
refresh_cache()
|
||||
|
@ -21,9 +21,9 @@ def fml(inp, reply=None):
|
|||
"""fml -- Gets a random quote from fmyfife.com."""
|
||||
|
||||
# grab the last item in the fml cache and remove it
|
||||
id, text = fml_cache.pop()
|
||||
fml_id, text = fml_cache.pop()
|
||||
# reply with the fml we grabbed
|
||||
reply('(#{}) {}'.format(id, text))
|
||||
reply('(#{}) {}'.format(fml_id, text))
|
||||
# refresh fml cache if its getting empty
|
||||
if len(fml_cache) < 3:
|
||||
refresh_cache()
|
||||
|
|
Reference in a new issue