def pun(self, ctx):
'''
Gives a random pun from the depths of the internet
'''
# Read from page
async with self.session.get('http://www.punoftheday.com/cgi-bin/randompun.pl') as r:
page = await r.text()
# Scrape the raw HTML
r = r'(<div class=\"dropshadow1\">\n<p>).*(</p>\n</div>)'
foundPun = [i for i in finditer(r, page)][0].group()
# Filter out the pun
r = r'(>).*(<)'
filteredPun = [i for i in finditer(r, foundPun)][0].group()
# Boop it out
fullPun = filteredPun[1:-1]
await self.sparcli.say(fullPun)
评论列表
文章目录