From e395d1570541c37f4dea8fad1d896cb89d0d1601 Mon Sep 17 00:00:00 2001 From: bradtimmis Date: Wed, 1 Sep 2021 07:35:31 -0400 Subject: Handle status not found with 404 picture Hard-coded in the appropriate 404 jpgs for wehn a status code does not exist from the dog or cat urls. --- bot/exts/evergreen/status_codes.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bot/exts/evergreen/status_codes.py') diff --git a/bot/exts/evergreen/status_codes.py b/bot/exts/evergreen/status_codes.py index 6151620d..501cbe0a 100644 --- a/bot/exts/evergreen/status_codes.py +++ b/bot/exts/evergreen/status_codes.py @@ -62,10 +62,17 @@ class HTTPStatusCodes(commands.Cog): ).set_image(url=url) ) elif response.status in (302, 404): # dog URL returns 302 instead of 404 + if "dog" in url: + await ctx.send( + embed=discord.Embed( + title=ERR_404.format(code=code) + ).set_image(url="https://httpstatusdogs.com/img/404.jpg") + ) + return await ctx.send( embed=discord.Embed( title=ERR_404.format(code=code) - ).set_image(url=url) + ).set_image(url="https://http.cat/404.jpg") ) else: await ctx.send( -- cgit v1.2.3