This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
CloudBot/plugins/wordoftheday.py
neersighted 79b4f15b45 pep8
2012-02-28 21:58:38 -08:00

21 lines
675 B
Python
Executable file

import re
from util import hook, http, misc
from BeautifulSoup import BeautifulSoup
@hook.command(autohelp=False)
def word(inp, say=False, nick=False):
".word -- Gets the word of the day."
page = http.get('http://merriam-webster.com/word-of-the-day')
soup = BeautifulSoup(page)
word = soup.find('strong', {'class' : 'main_entry_word'}).renderContents()
function = soup.find('p', {'class' : 'word_function'}).renderContents()
#definitions = re.findall(r'<span class="ssens"><strong>:</strong>'
# r' *([^<]+)</span>', content)
say("(%s) The word of the day is:"\
" \x02%s\x02 (%s)" % (nick, word, function))