diff options
author | 2021-08-03 14:13:51 -0700 | |
---|---|---|
committer | 2021-08-03 14:13:51 -0700 | |
commit | 6b5e749aef429accd1ae6fcf2519aad74dde3d2a (patch) | |
tree | c25e948a974e951b643e6acc182e16816aa8333c | |
parent | Merge branch 'main' into feature/stackoverflow (diff) | |
parent | Merge pull request #791 from onerandomusername/patch-1 (diff) |
Merge branch 'main' into feature/stackoverflow
-rw-r--r-- | .github/pull_request_template.md | 2 | ||||
-rw-r--r-- | bot/exts/halloween/scarymovie.py | 16 |
2 files changed, 7 insertions, 11 deletions
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ba418166..403438d1 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -17,4 +17,4 @@ Issues can be skipped with explicit core dev approval, but you have to link the - [ ] Join the [**Python Discord Community**](https://discord.gg/python)? - [ ] Read all the comments in this template? - [ ] Ensure there is an issue open, or link relevant discord discussions? -- [ ] Read the [contributing guidelines](https://pythondiscord.com/pages/contributing/contributing-guidelines/)? +- [ ] Read and agree to the [contributing guidelines](https://pythondiscord.com/pages/contributing/contributing-guidelines/)? 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() |