diff options
27 files changed, 547 insertions, 34 deletions
diff --git a/bot/__init__.py b/bot/__init__.py index 861a27fe..9e0290a7 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -30,7 +30,7 @@ logging.Logger.trace = monkeypatch_trace start_time = arrow.utcnow() # Set up file logging -log_dir = Path("bot", "log") +log_dir = Path("bot/log") log_file = log_dir / "hackbot.log" os.makedirs(log_dir, exist_ok=True) diff --git a/bot/resources/pride/anthems.json b/bot/resources/pride/anthems.json new file mode 100644 index 00000000..d80d7558 --- /dev/null +++ b/bot/resources/pride/anthems.json @@ -0,0 +1,455 @@ +[ + { + "title": "Bi", + "artist": "Alicia Champion", + "url": "https://www.youtube.com/watch?v=HekhW9STg58", + "genre": [ + "pop" + ] + }, + { + "title": "Queer Kidz", + "artist": "Ashby and the Oceanns", + "url": "https://www.youtube.com/watch?v=tSdCciMIlO8", + "genre": [ + "folk" + ] + }, + { + "title": "I Like Boys", + "artist": "Todrick Hall", + "url": "https://www.youtube.com/watch?v=RIbGksV3YBY", + "genre": [ + "dance", + "electronic" + ] + }, + { + "title": "It Girl", + "artist": "Mister Wallace", + "url": "https://www.youtube.com/watch?v=NEnmporrBuo", + "genre": [ + "dance", + "electronic" + ] + }, + { + "title": "Gay Sex", + "artist": "Be Steadwell", + "url": "https://www.youtube.com/watch?v=XnbQu_pzf8o", + "genre": [ + "pop" + ] + }, + { + "title": "Pynk", + "artist": "Janelle Monae", + "url": "https://www.youtube.com/watch?v=PaYvlVR_BEc", + "genre": [ + "rnb", + "rhythm and blues", + "r&b", + "soul" + ] + }, + { + "title": "I don't do boys", + "artist": "Elektra", + "url": "https://www.youtube.com/watch?v=MxAvsYrHOmI", + "genre": [ + "rock", + "pop" + ] + }, + { + "title": "Girls Like Girls", + "artist": "Hayley Kiyoko", + "url": "https://www.youtube.com/watch?v=I0MT8SwNa_U", + "genre": [ + "pop", + "electropop" + ] + }, + { + "title": "Girls/Girls/Boys", + "artist": "Panic! at the Disco", + "url": "https://www.youtube.com/watch?v=Yk8jV7r6VMk", + "genre": [ + "alt", + "alternative", + "indie", + "new-wave", + "electropop", + "pop", + "rock" + ] + }, + { + "title": "I Will Survive", + "artist": "Gloria Gaynor", + "url": "https://www.youtube.com/watch?v=gYkACVDFmeg", + "genre": [ + "jazz", + "disco", + "rnb", + "r&b", + "rhythm and blues", + "soul", + "dance", + "electronic", + "pop" + ] + }, + { + "title": "Born This Way", + "artist": "Lady Gaga", + "url": "https://www.youtube.com/watch?v=wV1FrqwZyKw", + "genre": [ + "pop", + "electropop" + ] + }, + { + "title": "Raise Your Glass", + "artist": "P!nk", + "url": "https://www.youtube.com/watch?v=XjVNlG5cZyQ", + "genre": [ + "pop", + "rock", + "pop-rock" + ] + }, + { + "title": "We R Who We R", + "artist": "Ke$ha", + "url": "https://www.youtube.com/watch?v=mXvmSaE0JXA", + "genre": [ + "pop", + "dance-pop" + ] + }, + { + "title": "I'm Coming Out", + "artist": "Diana Ross", + "url": "https://www.youtube.com/watch?v=zbYcte4ZEgQ", + "genre": [ + "disco", + "funk", + "soul" + ] + }, + { + "title": "She Keeps Me Warm", + "artist": "Mary Lambert", + "url": "https://www.youtube.com/watch?v=NhqH-r7Xj0E", + "genre": [ + "pop" + ] + }, + { + "title": "June", + "artist": "Florence + The Machine", + "url": "https://www.youtube.com/watch?v=Sosmd6RjeA0", + "genre": [ + "alt", + "indie", + "alternative" + ] + }, + { + "title": "Do I Wanna Know", + "artist": "MS MR", + "url": "https://youtu.be/0DCDf1O4e1Q", + "genre": [ + "indie", + "indie-pop" + ] + }, + { + "title": "Delilah", + "artist": "Florence + The Machine", + "url": "https://www.youtube.com/watch?v=zZr5Tid3Qw4", + "genre": [ + "alt", + "alternative", + "indie" + ] + }, + { + "title": "Queen", + "artist": "Janelle Monae", + "url": "https://www.youtube.com/watch?v=tEddixS-UoU", + "genre": [ + "neo-soul" + ] + }, + { + "title": "Aesthetic", + "artist": "Hi, I'm Case", + "url": "https://www.youtube.com/watch?v=cgq-XaSC1aY", + "genre": [ + "pop", + "pop-rock" + ] + }, + { + "title": "Break Free", + "artist": "Queen", + "url": "https://www.youtube.com/watch?v=f4Mc-NYPHaQ", + "genre": [ + "rock", + "synth-pop" + ] + }, + { + "title": "LGBT", + "artist": "CupcakKe", + "url": "https://www.youtube.com/watch?v=U_OArkw5yeQ", + "genre": [ + "hip-hop", + "rap" + ] + }, + { + "title": "Rainbow Connections", + "artist": "Garfunkel and Oates", + "url": "https://www.youtube.com/watch?v=MneRtx7x2vs", + "genre": [ + "folk" + ] + }, + { + "title": "Proud", + "artist": "Heather Small", + "url": "https://www.youtube.com/watch?v=LEoxGJ79PMs", + "genre": [ + "dance-pop", + "r&b", + "rhythm and blues", + "rnb" + ] + }, + { + "title": "LGBT", + "artist": "Lowell", + "url": "https://www.youtube.com/watch?v=QgE6nZmTGLw", + "genre": [ + "alternative", + "indie", + "alt", + "pop" + ] + }, + { + "title": "Kiss the Boy", + "artist": "Keiynan Lonsdale", + "url": "https://www.youtube.com/watch?v=bXzLZ7QQnpQ", + "genre": [ + "pop" + ] + }, + { + "title": "Boys Aside", + "artist": "Sofya Wang", + "url": "https://www.youtube.com/watch?v=NlAW7l6dmeA", + "genre": [ + "pop" + ] + }, + { + "title": "Everyone is Gay", + "artist": "A Great Big World", + "url": "https://www.youtube.com/watch?v=0VG1bj4Lj1Q", + "genre": [ + "pop" + ] + }, + { + "title": "The Queer Gospel", + "artist": "Erin McKeown", + "url": "https://www.youtube.com/watch?v=2vvOEoT-q_o", + "genre": [ + "christian", + "gospel" + ] + }, + { + "title": "Girls", + "artist": "Girl in Red", + "url": "https://www.youtube.com/watch?v=_BMBDY01kPk", + "genre": [ + "alternative", + "indie", + "alt" + ] + }, + { + "title": "Crazy World", + "artist": "MNEK", + "url": "https://www.youtube.com/watch?v=YBwzTgNL-zw", + "genre": [ + "pop" + ] + }, + { + "title": "Pride", + "artist": "Grace Petrie", + "url": "https://www.youtube.com/watch?v=y5rMrPJzFGs", + "genre": [ + "alt", + "alternative", + "indie" + ] + }, + { + "title": "Good Guys", + "artist": "MIKA", + "url": "https://www.youtube.com/watch?v=VZQ_9eebry0", + "genre": [ + "pop" + ] + }, + { + "title": "Gender is Boring", + "artist": "She/Her/Hers", + "url": "https://www.youtube.com/watch?v=glJW2vlBAQg", + "genre": [ + "punk" + ] + }, + { + "title": "GUY.exe", + "artist": "Superfruit", + "url": "https://www.youtube.com/watch?v=r2Kh_XMIDPU", + "genre": [ + "pop" + ] + }, + { + "title": "That's So Gay", + "artist": "Pansy Division", + "url": "https://www.youtube.com/watch?v=xlpcyeadaTk", + "genre": [ + "rock" + ] + }, + { + "title": "Strangers", + "artist": "Halsey", + "url": "https://www.youtube.com/watch?v=RVd_71ZdRd4", + "genre": [ + "pop", + "alt", + "alternative", + "indie", + "electropop" + ] + }, + { + "title": "LGBTQIA", + "artist": "Matt Fishel", + "url": "https://www.youtube.com/watch?v=KQq9f5hNOxE", + "genre": [ + "rock" + ] + }, + { + "title": "Tell Me a Story", + "artist": "Skylar Kergil", + "url": "https://www.youtube.com/watch?v=nbQDTE2s3dI", + "genre": [ + "folk" + ] + }, + { + "title": "Trans Is Love", + "artist": "Marissa Kay", + "url": "https://www.youtube.com/watch?v=-5f_1H0RD1I", + "genre": [ + "alt", + "alternative", + "indie", + "alt-country", + "alt-folk", + "indie-rock", + "new-southern-rock" + ] + }, + { + "title": "You Can't Tell Me", + "artist": "Jake Edwards", + "url": "https://www.youtube.com/watch?v=CwqDG5269Ak", + "genre": [ + "pop" + ] + }, + { + "title": "Closet Femme", + "artist": "Kate Reid", + "url": "https://www.youtube.com/watch?v=va-nqcNxP_k", + "genre": [ + "folk" + ] + }, + { + "title": "Let's Have a Kiki", + "artist": "Scissor Sisters", + "url": "https://www.youtube.com/watch?v=eGCD4xb-Tr8", + "genre": [ + "electropop", + "pop" + ] + }, + { + "title": "Gimme Gimme Gimme", + "artist": "ABBA", + "url": "https://www.youtube.com/watch?v=JWay7CDEyAI", + "genre": [ + "disco" + ] + }, + { + "title": "Dancing Queen", + "artist": "ABBA", + "url": "https://www.youtube.com/watch?v=xFrGuyw1V8s", + "genre": [ + "disco", + "europop", + "euero-disco" + ] + }, + { + "title": "City Grrl", + "artist": "CSS", + "url": "https://www.youtube.com/watch?v=duOA3FgpZqY", + "genre": [ + "electropop" + ] + }, + { + "title": "Blame it on the Girls", + "artist": "MIKA", + "url": "https://www.youtube.com/watch?v=iF_w7oaBHNo", + "genre": [ + "pop", + "pop-rock" + ] + }, + { + "title": "Bye Bye Bye", + "artist": "*NSYNC", + "url": "https://www.youtube.com/watch?v=Eo-KmOd3i7s", + "genre": [ + "pop", + "europop" + ] + }, + { + "title": "Gettin Bi", + "artist": "Crazy Ex-Girlfriend", + "url": "https://www.youtube.com/watch?v=5e7844P77Is", + "genre": [ + "pop" + ] + } +]
\ No newline at end of file diff --git a/bot/seasons/easter/april_fools_vids.py b/bot/seasons/easter/april_fools_vids.py index c504229d..9fbe87a0 100644 --- a/bot/seasons/easter/april_fools_vids.py +++ b/bot/seasons/easter/april_fools_vids.py @@ -19,7 +19,7 @@ class AprilFoolVideos(commands.Cog): @staticmethod def load_json(): """A function to load JSON data.""" - p = Path('bot', 'resources', 'easter', 'april_fools_vids.json') + p = Path('bot/resources/easterapril_fools_vids.json') with p.open() as json_file: all_vids = load(json_file) return all_vids diff --git a/bot/seasons/easter/avatar_easterifier.py b/bot/seasons/easter/avatar_easterifier.py index 0e0b5934..ad8b5473 100644 --- a/bot/seasons/easter/avatar_easterifier.py +++ b/bot/seasons/easter/avatar_easterifier.py @@ -104,7 +104,7 @@ class AvatarEasterifier(commands.Cog): im.alpha_composite(egg, (im.width - egg.width, (im.height - egg.height)//2)) # Right centre. ctx.send = send_message # Reassigns ctx.send else: - bunny = Image.open(Path("bot", "resources", "easter", "chocolate_bunny.png")) + bunny = Image.open(Path("bot/resources/easter/chocolate_bunny.png")) im.alpha_composite(bunny, (im.width - bunny.width, (im.height - bunny.height)//2)) # Right centre. bufferedio = BytesIO() diff --git a/bot/seasons/easter/conversationstarters.py b/bot/seasons/easter/conversationstarters.py index 4432c348..c2cdf26c 100644 --- a/bot/seasons/easter/conversationstarters.py +++ b/bot/seasons/easter/conversationstarters.py @@ -7,7 +7,7 @@ from discord.ext import commands log = logging.getLogger(__name__) -with open(Path('bot', 'resources', 'easter', 'starter.json'), 'r', encoding="utf8") as f: +with open(Path("bot/resources/easter/starter.json"), "r", encoding="utf8") as f: starters = json.load(f) diff --git a/bot/seasons/easter/egg_decorating.py b/bot/seasons/easter/egg_decorating.py index 58d070bc..ee8a80e5 100644 --- a/bot/seasons/easter/egg_decorating.py +++ b/bot/seasons/easter/egg_decorating.py @@ -12,10 +12,10 @@ from discord.ext import commands log = logging.getLogger(__name__) -with open(Path("bot", "resources", "evergreen", "html_colours.json")) as f: +with open(Path("bot/resources/evergreen/html_colours.json")) as f: HTML_COLOURS = json.load(f) -with open(Path("bot", "resources", "evergreen", "xkcd_colours.json")) as f: +with open(Path("bot/resources/evergreen/xkcd_colours.json")) as f: XKCD_COLOURS = json.load(f) COLOURS = [ @@ -77,7 +77,7 @@ class EggDecorating(commands.Cog): q, r = divmod(8, colours_n) colours = colours * q + colours[:r] num = random.randint(1, 6) - im = Image.open(Path("bot", "resources", "easter", "easter_eggs", f"design{num}.png")) + im = Image.open(Path(f"bot/resources/easter/easter_eggs/design{num}.png")) data = list(im.getdata()) replaceable = {x for x in data if x not in IRREPLACEABLE} diff --git a/bot/seasons/easter/egg_hunt/cog.py b/bot/seasons/easter/egg_hunt/cog.py index 110a39f5..30fd3284 100644 --- a/bot/seasons/easter/egg_hunt/cog.py +++ b/bot/seasons/easter/egg_hunt/cog.py @@ -15,7 +15,7 @@ from .constants import Colours, EggHuntSettings, Emoji, Roles log = logging.getLogger(__name__) -DB_PATH = Path("bot", "resources", "persist", "egg_hunt.sqlite") +DB_PATH = Path("bot/resources/persist/egg_hunt.sqlite") TEAM_MAP = { Roles.white: Emoji.egg_white, diff --git a/bot/seasons/easter/egghead_quiz.py b/bot/seasons/easter/egghead_quiz.py index 7adeaebd..3e0cc598 100644 --- a/bot/seasons/easter/egghead_quiz.py +++ b/bot/seasons/easter/egghead_quiz.py @@ -11,7 +11,7 @@ from bot.constants import Colours log = logging.getLogger(__name__) -with open(Path('bot', 'resources', 'easter', 'egghead_questions.json'), 'r', encoding="utf8") as f: +with open(Path("bot/resources/easter/egghead_questions.json"), "r", encoding="utf8") as f: EGGHEAD_QUESTIONS = load(f) diff --git a/bot/seasons/easter/traditions.py b/bot/seasons/easter/traditions.py index bed874f9..f04b8828 100644 --- a/bot/seasons/easter/traditions.py +++ b/bot/seasons/easter/traditions.py @@ -7,7 +7,7 @@ from discord.ext import commands log = logging.getLogger(__name__) -with open(Path('bot', 'resources', 'easter', 'traditions.json'), 'r', encoding="utf8") as f: +with open(Path("bot/resources/easter/traditions.json"), "r", encoding="utf8") as f: traditions = json.load(f) diff --git a/bot/seasons/evergreen/magic_8ball.py b/bot/seasons/evergreen/magic_8ball.py index 9add06af..55652af7 100644 --- a/bot/seasons/evergreen/magic_8ball.py +++ b/bot/seasons/evergreen/magic_8ball.py @@ -13,7 +13,7 @@ class Magic8ball(commands.Cog): def __init__(self, bot): self.bot = bot - with open(Path("bot", "resources", "evergreen", "magic8ball.json"), "r") as file: + with open(Path("bot/resources/evergreen/magic8ball.json"), "r") as file: self.answers = json.load(file) @commands.command(name="8ball") diff --git a/bot/seasons/evergreen/snakes/utils.py b/bot/seasons/evergreen/snakes/utils.py index 3754a122..88fb2032 100644 --- a/bot/seasons/evergreen/snakes/utils.py +++ b/bot/seasons/evergreen/snakes/utils.py @@ -13,7 +13,7 @@ from PIL.ImageDraw import ImageDraw from discord import File, Member, Reaction from discord.ext.commands import Context -SNAKE_RESOURCES = Path('bot', 'resources', 'snakes').absolute() +SNAKE_RESOURCES = Path("bot/resources/snakes").absolute() h1 = r'''``` ---- diff --git a/bot/seasons/halloween/8ball.py b/bot/seasons/halloween/8ball.py index d7bddbfb..faf59ca9 100644 --- a/bot/seasons/halloween/8ball.py +++ b/bot/seasons/halloween/8ball.py @@ -8,7 +8,7 @@ from discord.ext import commands log = logging.getLogger(__name__) -with open(Path('bot', 'resources', 'halloween', 'responses.json'), 'r', encoding="utf8") as f: +with open(Path("bot/resources/halloween/responses.json"), "r", encoding="utf8") as f: responses = json.load(f) diff --git a/bot/seasons/halloween/hacktoberstats.py b/bot/seasons/halloween/hacktoberstats.py index c30ad90f..b6b5a900 100644 --- a/bot/seasons/halloween/hacktoberstats.py +++ b/bot/seasons/halloween/hacktoberstats.py @@ -18,7 +18,7 @@ class HacktoberStats(commands.Cog): def __init__(self, bot): self.bot = bot - self.link_json = Path("bot", "resources", "github_links.json") + self.link_json = Path("bot/resources/github_links.json") self.linked_accounts = self.load_linked_users() @commands.group( diff --git a/bot/seasons/halloween/halloween_facts.py b/bot/seasons/halloween/halloween_facts.py index 00d91bc5..f09aa4ad 100644 --- a/bot/seasons/halloween/halloween_facts.py +++ b/bot/seasons/halloween/halloween_facts.py @@ -30,7 +30,7 @@ class HalloweenFacts(commands.Cog): def __init__(self, bot): self.bot = bot - with open(Path("bot", "resources", "halloween", "halloween_facts.json"), "r") as file: + with open(Path("bot/resources/halloween/halloween_facts.json"), "r") as file: self.halloween_facts = json.load(file) self.channel = None self.facts = list(enumerate(self.halloween_facts)) diff --git a/bot/seasons/halloween/halloweenify.py b/bot/seasons/halloween/halloweenify.py index 4d56e2f8..334781ab 100644 --- a/bot/seasons/halloween/halloweenify.py +++ b/bot/seasons/halloween/halloweenify.py @@ -21,23 +21,23 @@ class Halloweenify(commands.Cog): async def halloweenify(self, ctx): """Change your nickname into a much spookier one!""" async with ctx.typing(): - with open(Path('bot', 'resources', 'halloween', 'halloweenify.json'), 'r') as f: + with open(Path("bot/resources/halloween/halloweenify.json"), "r") as f: data = load(f) # Choose a random character from our list we loaded above and set apart the nickname and image url. - character = choice(data['characters']) + character = choice(data["characters"]) nickname = ''.join([nickname for nickname in character]) image = ''.join([character[nickname] for nickname in character]) # Build up a Embed embed = discord.Embed() embed.colour = discord.Colour.dark_orange() - embed.title = 'Not spooky enough?' + embed.title = "Not spooky enough?" embed.description = ( - f'**{ctx.author.display_name}** wasn\'t spooky enough for you? That\'s understandable, ' - f'{ctx.author.display_name} isn\'t scary at all! ' - 'Let me think of something better. Hmm... I got it!\n\n ' - f'Your new nickname will be: \n :ghost: **{nickname}** :jack_o_lantern:' + f"**{ctx.author.display_name}** wasn\'t spooky enough for you? That\'s understandable, " + f"{ctx.author.display_name} isn\'t scary at all! " + "Let me think of something better. Hmm... I got it!\n\n " + f"Your new nickname will be: \n :ghost: **{nickname}** :jack_o_lantern:" ) embed.set_image(url=image) diff --git a/bot/seasons/halloween/spookyrating.py b/bot/seasons/halloween/spookyrating.py index 18a963e0..08c17a27 100644 --- a/bot/seasons/halloween/spookyrating.py +++ b/bot/seasons/halloween/spookyrating.py @@ -11,7 +11,7 @@ from bot.constants import Colours log = logging.getLogger(__name__) -with Path('bot', 'resources', 'halloween', 'spooky_rating.json').open() as file: +with Path("bot/resources/halloween/spooky_rating.json").open() as file: SPOOKY_DATA = json.load(file) SPOOKY_DATA = sorted((int(key), value) for key, value in SPOOKY_DATA.items()) diff --git a/bot/seasons/halloween/spookysound.py b/bot/seasons/halloween/spookysound.py index 995f0403..44fdd9d6 100644 --- a/bot/seasons/halloween/spookysound.py +++ b/bot/seasons/halloween/spookysound.py @@ -15,7 +15,7 @@ class SpookySound(commands.Cog): def __init__(self, bot): self.bot = bot - self.sound_files = list(Path("bot", "resources", "halloween", "spookysounds").glob("*.mp3")) + self.sound_files = list(Path("bot/resources/halloween/spookysounds").glob("*.mp3")) self.channel = None @commands.cooldown(rate=1, per=1) diff --git a/bot/seasons/pride/pride_anthem.py b/bot/seasons/pride/pride_anthem.py new file mode 100644 index 00000000..f226f4bb --- /dev/null +++ b/bot/seasons/pride/pride_anthem.py @@ -0,0 +1,58 @@ +import json +import logging +import random +from pathlib import Path + +from discord.ext import commands + +log = logging.getLogger(__name__) + + +class PrideAnthem(commands.Cog): + """Embed a random youtube video for a gay anthem!""" + + def __init__(self, bot): + self.bot = bot + self.anthems = self.load_vids() + + def get_video(self, genre: str = None) -> dict: + """ + Picks a random anthem from the list. + + If `genre` is supplied, it will pick from videos attributed with that genre. + If none can be found, it will log this as well as provide that information to the user. + """ + if not genre: + return random.choice(self.anthems) + else: + songs = [song for song in self.anthems if genre.casefold() in song["genre"]] + try: + return random.choice(songs) + except IndexError: + log.info("No videos for that genre.") + + @staticmethod + def load_vids() -> list: + """Loads a list of videos from the resources folder as dictionaries.""" + with open(Path("bot/resources/pride/anthems.json"), "r", encoding="utf-8") as f: + anthems = json.load(f) + return anthems + + @commands.command(name="prideanthem", aliases=["anthem", "pridesong"]) + async def prideanthem(self, ctx, genre: str = None): + """ + Sends a message with a video of a random pride anthem. + + If `genre` is supplied, it will select from that genre only. + """ + anthem = self.get_video(genre) + if anthem: + await ctx.send(anthem["url"]) + else: + await ctx.send("I couldn't find a video, sorry!") + + +def setup(bot): + """Cog loader for pride anthem.""" + bot.add_cog(PrideAnthem(bot)) + log.info("Pride anthems cog loaded!") diff --git a/bot/seasons/pride/pride_avatar.py b/bot/seasons/pride/pride_avatar.py index b7cd1331..a5b38d20 100644 --- a/bot/seasons/pride/pride_avatar.py +++ b/bot/seasons/pride/pride_avatar.py @@ -106,7 +106,7 @@ class PrideAvatar(commands.Cog): avatar = self.crop_avatar(avatar) - ring = Image.open(Path("bot", "resources", "pride", "flags", f"{flag}.png")).resize((1024, 1024)) + ring = Image.open(Path(f"bot/resources/pride/flags/{flag}.png")).resize((1024, 1024)) ring = ring.convert("RGBA") ring = self.crop_ring(ring, pixels) diff --git a/bot/seasons/season.py b/bot/seasons/season.py index e6a262c8..cd2306a6 100644 --- a/bot/seasons/season.py +++ b/bot/seasons/season.py @@ -24,7 +24,7 @@ def get_seasons() -> List[str]: """Returns all the Season objects located in /bot/seasons/.""" seasons = [] - for module in pkgutil.iter_modules([Path("bot", "seasons")]): + for module in pkgutil.iter_modules([Path("bot/seasons")]): if module.ispkg: seasons.append(module.name) return seasons @@ -308,7 +308,7 @@ class SeasonBase: for ext_folder in {self.name, "evergreen"}: if ext_folder: log.info(f"Start loading extensions from seasons/{ext_folder}/") - path = Path("bot", "seasons", ext_folder) + path = Path("bot/seasons") / ext_folder for ext_name in [i[1] for i in pkgutil.iter_modules([path])]: extensions.append(f"bot.seasons.{ext_folder}.{ext_name}") diff --git a/bot/seasons/valentines/be_my_valentine.py b/bot/seasons/valentines/be_my_valentine.py index 08fea33d..ac140896 100644 --- a/bot/seasons/valentines/be_my_valentine.py +++ b/bot/seasons/valentines/be_my_valentine.py @@ -25,7 +25,7 @@ class BeMyValentine(commands.Cog): @staticmethod def load_json(): """Load Valentines messages from the static resources.""" - p = Path('bot', 'resources', 'valentines', 'bemyvalentine_valentines.json') + p = Path("bot/resources/valentines/bemyvalentine_valentines.json") with p.open() as json_data: valentines = load(json_data) return valentines diff --git a/bot/seasons/valentines/lovecalculator.py b/bot/seasons/valentines/lovecalculator.py index ca8eaaf6..1d5a028d 100644 --- a/bot/seasons/valentines/lovecalculator.py +++ b/bot/seasons/valentines/lovecalculator.py @@ -15,7 +15,7 @@ from bot.constants import Roles log = logging.getLogger(__name__) -with Path('bot', 'resources', 'valentines', 'love_matches.json').open() as file: +with Path("bot/resources/valentines/love_matches.json").open() as file: LOVE_DATA = json.load(file) LOVE_DATA = sorted((int(key), value) for key, value in LOVE_DATA.items()) diff --git a/bot/seasons/valentines/myvalenstate.py b/bot/seasons/valentines/myvalenstate.py index 6a8d8b1d..fad202e3 100644 --- a/bot/seasons/valentines/myvalenstate.py +++ b/bot/seasons/valentines/myvalenstate.py @@ -11,7 +11,7 @@ from bot.constants import Colours log = logging.getLogger(__name__) -with open(Path('bot', 'resources', 'valentines', 'valenstates.json'), 'r') as file: +with open(Path("bot/resources/valentines/valenstates.json"), "r") as file: STATES = json.load(file) diff --git a/bot/seasons/valentines/pickuplines.py b/bot/seasons/valentines/pickuplines.py index 00ed5453..46772197 100644 --- a/bot/seasons/valentines/pickuplines.py +++ b/bot/seasons/valentines/pickuplines.py @@ -10,7 +10,7 @@ from bot.constants import Colours log = logging.getLogger(__name__) -with open(Path('bot', 'resources', 'valentines', 'pickup_lines.json'), 'r', encoding="utf8") as f: +with open(Path("bot/resources/valentines/pickup_lines.json"), "r", encoding="utf8") as f: pickup_lines = load(f) diff --git a/bot/seasons/valentines/savethedate.py b/bot/seasons/valentines/savethedate.py index a2d9a22d..34264183 100644 --- a/bot/seasons/valentines/savethedate.py +++ b/bot/seasons/valentines/savethedate.py @@ -12,7 +12,7 @@ log = logging.getLogger(__name__) HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_heart:", ":two_hearts:"] -with open(Path('bot', 'resources', 'valentines', 'date_ideas.json'), 'r', encoding="utf8") as f: +with open(Path("bot/resources/valentines/date_ideas.json"), "r", encoding="utf8") as f: VALENTINES_DATES = load(f) diff --git a/bot/seasons/valentines/valentine_zodiac.py b/bot/seasons/valentines/valentine_zodiac.py index 7f78d3bc..fa849cb2 100644 --- a/bot/seasons/valentines/valentine_zodiac.py +++ b/bot/seasons/valentines/valentine_zodiac.py @@ -24,7 +24,7 @@ class ValentineZodiac(commands.Cog): @staticmethod def load_json(): """Load zodiac compatibility from static JSON resource.""" - p = Path('bot', 'resources', 'valentines', 'zodiac_compatibility.json') + p = Path("bot/resources/valentines/zodiac_compatibility.json") with p.open() as json_data: zodiacs = load(json_data) return zodiacs diff --git a/bot/seasons/valentines/whoisvalentine.py b/bot/seasons/valentines/whoisvalentine.py index 0a868fe6..d73ccd9b 100644 --- a/bot/seasons/valentines/whoisvalentine.py +++ b/bot/seasons/valentines/whoisvalentine.py @@ -10,7 +10,7 @@ from bot.constants import Colours log = logging.getLogger(__name__) -with open(Path("bot", "resources", "valentines", "valentine_facts.json"), "r") as file: +with open(Path("bot/resources/valentines/valentine_facts.json"), "r") as file: FACTS = json.load(file) |