diff options
Diffstat (limited to 'bot/exts/holidays')
| -rw-r--r-- | bot/exts/holidays/easter/earth_photos.py | 6 | ||||
| -rw-r--r-- | bot/exts/holidays/halloween/scarymovie.py | 4 | ||||
| -rw-r--r-- | bot/exts/holidays/halloween/spookygif.py | 2 | ||||
| -rw-r--r-- | bot/exts/holidays/valentines/be_my_valentine.py | 6 | ||||
| -rw-r--r-- | bot/exts/holidays/valentines/lovecalculator.py | 6 |
5 files changed, 12 insertions, 12 deletions
diff --git a/bot/exts/holidays/easter/earth_photos.py b/bot/exts/holidays/easter/earth_photos.py index e60e2626..013122c8 100644 --- a/bot/exts/holidays/easter/earth_photos.py +++ b/bot/exts/holidays/easter/earth_photos.py @@ -23,7 +23,7 @@ class EarthPhotos(commands.Cog): async with ctx.typing(): async with self.bot.http_session.get( API_URL, - params={"query": "planet_earth", "client_id": Tokens.unsplash_access_key} + params={"query": "planet_earth", "client_id": Tokens.unsplash.get_secret_value()} ) as r: jsondata = await r.json() linksdata = jsondata.get("urls") @@ -37,7 +37,7 @@ class EarthPhotos(commands.Cog): rf = "?utm_source=Sir%20Lancebot&utm_medium=referral" async with self.bot.http_session.get( downloadlinksdata.get("download_location"), - params={"client_id": Tokens.unsplash_access_key} + params={"client_id": Tokens.unsplash.get_secret_value()} ) as _: pass @@ -59,7 +59,7 @@ class EarthPhotos(commands.Cog): async def setup(bot: Bot) -> None: """Load the Earth Photos cog.""" - if not Tokens.unsplash_access_key: + if not Tokens.unsplash: log.warning("No Unsplash access key found. Cog not loading.") return await bot.add_cog(EarthPhotos(bot)) diff --git a/bot/exts/holidays/halloween/scarymovie.py b/bot/exts/holidays/halloween/scarymovie.py index 9f1a95fd..00c96153 100644 --- a/bot/exts/holidays/halloween/scarymovie.py +++ b/bot/exts/holidays/halloween/scarymovie.py @@ -36,7 +36,7 @@ class ScaryMovie(commands.Cog): """Selects a random movie and returns a JSON of movie details from TMDb.""" url = "https://api.themoviedb.org/3/discover/movie" params = { - "api_key": Tokens.tmdb, + "api_key": Tokens.tmdb.get_secret_value(), "with_genres": "27", "vote_count.gte": "5", "include_adult": "false" @@ -65,7 +65,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": Tokens.tmdb, "append_to_response": "credits"} + params={"api_key": Tokens.tmdb.get_secret_value(), "append_to_response": "credits"} ) as selection: return await selection.json() diff --git a/bot/exts/holidays/halloween/spookygif.py b/bot/exts/holidays/halloween/spookygif.py index 750e86ca..7a90a8a9 100644 --- a/bot/exts/holidays/halloween/spookygif.py +++ b/bot/exts/holidays/halloween/spookygif.py @@ -21,7 +21,7 @@ class SpookyGif(commands.Cog): async def spookygif(self, ctx: commands.Context) -> None: """Fetches a random gif from the GIPHY API and responds with it.""" async with ctx.typing(): - params = {"api_key": Tokens.giphy, "tag": "halloween", "rating": "g"} + params = {"api_key": Tokens.giphy.get_secret_value(), "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(API_URL, params=params) as resp: data = await resp.json() diff --git a/bot/exts/holidays/valentines/be_my_valentine.py b/bot/exts/holidays/valentines/be_my_valentine.py index 5ffd14e6..3a2beef3 100644 --- a/bot/exts/holidays/valentines/be_my_valentine.py +++ b/bot/exts/holidays/valentines/be_my_valentine.py @@ -7,7 +7,7 @@ import discord from discord.ext import commands from bot.bot import Bot -from bot.constants import Channels, Colours, Lovefest, Month, PYTHON_PREFIX +from bot.constants import Channels, Colours, Month, PYTHON_PREFIX, Roles from bot.utils.decorators import in_month from bot.utils.exceptions import MovedCommandError @@ -60,7 +60,7 @@ class BeMyValentine(commands.Cog): # This command should only be used in the server raise commands.UserInputError("You are supposed to use this command in the server.") - if Lovefest.role_id not in [role.id for role in user.roles]: + if Roles.lovefest not in [role.id for role in user.roles]: raise commands.UserInputError( f"You cannot send a valentine to {user} as they do not have the lovefest role!" ) @@ -95,7 +95,7 @@ class BeMyValentine(commands.Cog): example : .bemyvalentine secret Iceman#6508 Hey I love you, wanna hang around ? (sends the custom message to Iceman in DM making you anonymous) """ - if Lovefest.role_id not in [role.id for role in user.roles]: + if Roles.lovefest not in [role.id for role in user.roles]: await ctx.message.delete() raise commands.UserInputError( f"You cannot send a valentine to {user} as they do not have the lovefest role!" diff --git a/bot/exts/holidays/valentines/lovecalculator.py b/bot/exts/holidays/valentines/lovecalculator.py index c212e833..eab3d083 100644 --- a/bot/exts/holidays/valentines/lovecalculator.py +++ b/bot/exts/holidays/valentines/lovecalculator.py @@ -12,7 +12,7 @@ from discord.ext import commands from discord.ext.commands import BadArgument, Cog, clean_content from bot.bot import Bot -from bot.constants import Channels, Lovefest, Month, PYTHON_PREFIX +from bot.constants import Channels, Month, PYTHON_PREFIX, Roles from bot.utils.decorators import in_month log = logging.getLogger(__name__) @@ -45,8 +45,8 @@ class LoveCalculator(Cog): Running .love @chrisjl#2655 @joe#6000 will yield the same result as before. """ if ( - Lovefest.role_id not in [role.id for role in who.roles] - or (whom is not None and Lovefest.role_id not in [role.id for role in whom.roles]) + Roles.lovefest not in [role.id for role in who.roles] + or (whom is not None and Roles.lovefest not in [role.id for role in whom.roles]) ): raise BadArgument( "This command can only be ran against members with the lovefest role! " |