aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/pride/pride_anthem.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/pride/pride_anthem.py')
-rw-r--r--bot/exts/pride/pride_anthem.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/bot/exts/pride/pride_anthem.py b/bot/exts/pride/pride_anthem.py
index ce4b06af..4650595a 100644
--- a/bot/exts/pride/pride_anthem.py
+++ b/bot/exts/pride/pride_anthem.py
@@ -10,13 +10,12 @@ from bot.bot import Bot
log = logging.getLogger(__name__)
+VIDEOS = json.loads(Path("bot/resources/pride/anthems.json").read_text("utf8"))
+
class PrideAnthem(commands.Cog):
"""Embed a random youtube video for a gay anthem!"""
- def __init__(self):
- self.anthems = self.load_vids()
-
def get_video(self, genre: Optional[str] = None) -> dict:
"""
Picks a random anthem from the list.
@@ -27,17 +26,12 @@ class PrideAnthem(commands.Cog):
if not genre:
return random.choice(self.anthems)
else:
- songs = [song for song in self.anthems if genre.casefold() in song["genre"]]
+ songs = [song for song in VIDEOS 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."""
- return json.loads(Path("bot/resources/pride/anthems.json").read_text("utf8"))
-
@commands.command(name="prideanthem", aliases=("anthem", "pridesong"))
async def prideanthem(self, ctx: commands.Context, genre: str = None) -> None:
"""