aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/pride/pride_anthem.py
diff options
context:
space:
mode:
authorGravatar Janine vN <[email protected]>2021-09-04 23:43:25 -0400
committerGravatar Janine vN <[email protected]>2021-09-04 23:43:25 -0400
commit76c143dd5ced4f1d5aafbc389f94cd1c0189305b (patch)
tree00e7a7c0d71b673d0b5b0e57c8d2ac1b081cd82d /bot/exts/pride/pride_anthem.py
parentMove Valentines to Holidays folder (diff)
Move Pride to Holidays folder
Moves the Pride features to the Holidays folder. Corrected the paths to reflect this change.
Diffstat (limited to 'bot/exts/pride/pride_anthem.py')
-rw-r--r--bot/exts/pride/pride_anthem.py51
1 files changed, 0 insertions, 51 deletions
diff --git a/bot/exts/pride/pride_anthem.py b/bot/exts/pride/pride_anthem.py
deleted file mode 100644
index 05286b3d..00000000
--- a/bot/exts/pride/pride_anthem.py
+++ /dev/null
@@ -1,51 +0,0 @@
-import json
-import logging
-import random
-from pathlib import Path
-from typing import Optional
-
-from discord.ext import commands
-
-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 get_video(self, genre: Optional[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(VIDEOS)
- else:
- 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.")
-
- @commands.command(name="prideanthem", aliases=("anthem", "pridesong"))
- async def prideanthem(self, ctx: commands.Context, genre: str = None) -> 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: Bot) -> None:
- """Load the Pride Anthem Cog."""
- bot.add_cog(PrideAnthem())