aboutsummaryrefslogtreecommitdiffstats
path: root/bot/seasons
diff options
context:
space:
mode:
authorGravatar AvianAnalyst <[email protected]>2019-06-17 20:04:29 -0400
committerGravatar AvianAnalyst <[email protected]>2019-06-17 20:04:29 -0400
commit9864f61b92dc0e1d2ac8b035edcaeb06503e20c9 (patch)
treeb62e95bbdf0ddd208c533d89a603b7f3328f8810 /bot/seasons
parentInitial commit, added pride anthems (diff)
Wrote initial code for running the bot command.
Diffstat (limited to 'bot/seasons')
-rw-r--r--bot/seasons/pride/pride_anthem.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/bot/seasons/pride/pride_anthem.py b/bot/seasons/pride/pride_anthem.py
new file mode 100644
index 00000000..1b8ad6cc
--- /dev/null
+++ b/bot/seasons/pride/pride_anthem.py
@@ -0,0 +1,46 @@
+import logging
+from pathlib import Path
+from json import load
+from random import choice
+
+from discord.ext import commands
+
+
+log = logging.getLogger(__name__)
+
+
+OPTIONS = {
+
+}
+
+
+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=None):
+ if not genre:
+ return choice(self.anthems)
+ else:
+ songs = [song for song in self.anthems if genre in song.genre]
+ return choice(songs)
+
+ @staticmethod
+ def load_vids():
+ with open(Path('bot', 'resources', 'pride', 'anthems.json').absolute(), 'r') as f:
+ anthems = load(f)
+ return anthems
+
+ @commands.command(name='prideanthem')
+ async def send_anthem(self, ctx, genre=None):
+ video = self.get_video(genre)
+ await ctx.send(f'Here\'s a pride anthem for you! {video.url}')
+
+
+def setup(bot):
+ """Cog loader for pride anthem"""
+ bot.add_cog(PrideAnthem(bot))
+ log.info('Pride anthems cog loaded!')