aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/halloween/spookygif.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/halloween/spookygif.py')
-rw-r--r--bot/exts/halloween/spookygif.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bot/exts/halloween/spookygif.py b/bot/exts/halloween/spookygif.py
index ffb91b1b..a2146a84 100644
--- a/bot/exts/halloween/spookygif.py
+++ b/bot/exts/halloween/spookygif.py
@@ -8,6 +8,8 @@ from bot.constants import Tokens
log = logging.getLogger(__name__)
+API_URL = "http://api.giphy.com/v1/gifs/random"
+
class SpookyGif(commands.Cog):
"""A cog to fetch a random spooky gif from the web!"""
@@ -21,12 +23,11 @@ class SpookyGif(commands.Cog):
async with ctx.typing():
params = {"api_key": Tokens.giphy, "tag": "halloween", "rating": "g"}
# Make a GET request to the Giphy API to get a random halloween gif.
- async with self.bot.http_session.get("http://api.giphy.com/v1/gifs/random", params=params) as resp:
+ async with self.bot.http_session.get(API_URL, params=params) as resp:
data = await resp.json()
url = data["data"]["image_url"]
- embed = discord.Embed(colour=0x9b59b6)
- embed.title = "A spooooky gif!"
+ embed = discord.Embed(title="A spooooky gif!", colour=0x9b59b6)
embed.set_image(url=url)
await ctx.send(embed=embed)