diff options
author | 2021-07-31 01:30:25 -0700 | |
---|---|---|
committer | 2021-07-31 01:30:25 -0700 | |
commit | 2b16591934987feb10a0364261b0a21bb1fa714a (patch) | |
tree | f87299710e8940d389e8cc2f9a84b78b219648cf | |
parent | make user affirm their pr follows guidelines (diff) | |
parent | Merge pull request #777 from D0rs4n/pr/fixscarymovie (diff) |
Merge branch 'main' into patch-1
-rw-r--r-- | bot/exts/halloween/scarymovie.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/bot/exts/halloween/scarymovie.py b/bot/exts/halloween/scarymovie.py index f4cf41db..33659fd8 100644 --- a/bot/exts/halloween/scarymovie.py +++ b/bot/exts/halloween/scarymovie.py @@ -1,19 +1,14 @@ import logging import random -from os import environ from discord import Embed from discord.ext import commands from bot.bot import Bot - +from bot.constants import Tokens log = logging.getLogger(__name__) -TMDB_API_KEY = environ.get("TMDB_API_KEY") -TMDB_TOKEN = environ.get("TMDB_TOKEN") - - class ScaryMovie(commands.Cog): """Selects a random scary movie and embeds info into Discord chat.""" @@ -31,13 +26,14 @@ class ScaryMovie(commands.Cog): async def select_movie(self) -> dict: """Selects a random movie and returns a JSON of movie details from TMDb.""" - url = "https://api.themoviedb.org/4/discover/movie" + url = "https://api.themoviedb.org/3/discover/movie" params = { + "api_key": Tokens.tmdb, "with_genres": "27", - "vote_count.gte": "5" + "vote_count.gte": "5", + "include_adult": "false" } headers = { - "Authorization": "Bearer " + TMDB_TOKEN, "Content-Type": "application/json;charset=utf-8" } @@ -55,7 +51,7 @@ class ScaryMovie(commands.Cog): # Get full details and credits async with self.bot.http_session.get( url=f"https://api.themoviedb.org/3/movie/{selection_id}", - params={"api_key": TMDB_API_KEY, "append_to_response": "credits"} + params={"api_key": Tokens.tmdb, "append_to_response": "credits"} ) as selection: return await selection.json() |