From e4ef3c075b92cc6f1e1c361dfacb01e04010b6c9 Mon Sep 17 00:00:00 2001 From: phxntxm Date: Tue, 2 May 2017 19:29:14 -0500 Subject: [PATCH] Use better jokes --- cogs/misc.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/cogs/misc.py b/cogs/misc.py index 1536d50..48c378e 100644 --- a/cogs/misc.py +++ b/cogs/misc.py @@ -258,17 +258,11 @@ class Miscallaneous: EXAMPLE: !joke RESULT: An absolutely terrible joke.""" - # Use the fortune riddles command because it's funny, I promise - fortune_command = "/usr/bin/fortune riddles" - while True: - try: - fortune = subprocess.check_output( - fortune_command.split()).decode("utf-8") - await ctx.send(fortune) - except discord.HTTPException: - pass - else: - break + joke = await utils.request('http://tambal.azurewebsites.net/joke/random') + if joke is not None and 'joke' in joke: + await ctx.send(joke.get('joke')) + else: + await ctx.send("Sorry, I'm not feeling funny right now...try later") @commands.command() @utils.custom_perms(send_messages=True)