23 lines
442 B
Python
23 lines
442 B
Python
|
|
import requests
|
|
|
|
from sopel import plugin
|
|
|
|
from sopel_SpiceBot_Core_Prerun import prerun
|
|
|
|
|
|
@prerun()
|
|
@plugin.command('dad', 'dadjoke')
|
|
def upper(bot, trigger, comrun):
|
|
joke = getDadJoke()
|
|
if not joke:
|
|
joke = 'My humor module is broken.'
|
|
comrun.say(str(joke))
|
|
|
|
|
|
def getDadJoke():
|
|
url = 'https://icanhazdadjoke.com'
|
|
page = requests.get(url, headers={'Accept': 'text/plain'})
|
|
joke = page.content
|
|
return joke
|