import requests


def dadjoke(bot, trigger):
    """Posts a dad joke."""
    url = "https://icanhazdadjoke.com"
    headers = {'Accept': 'application/json'}
    try:
        dad_joke = requests.get(url, headers=headers).json()['joke']
    except Exception:
        return bot.reply("Error reaching API, probably.")
    bot.say(dad_joke)