aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/easter/april_fools_vids.py
blob: 5ef40704fa71baca8bf3fccfd53035cf37613e0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import logging
import random
from json import loads
from pathlib import Path

from discord.ext import commands

from bot.bot import Bot

log = logging.getLogger(__name__)

ALL_VIDS = loads(Path("bot/resources/easter/april_fools_vids.json").read_text("utf-8"))


class AprilFoolVideos(commands.Cog):
    """A cog for April Fools' that gets a random April Fools' video from Youtube."""

    @commands.command(name="fool")
    async def april_fools(self, ctx: commands.Context) -> None:
        """Get a random April Fools' video from Youtube."""
        video = random.choice(ALL_VIDS)

        channel, url = video["channel"], video["url"]

        await ctx.send(f"Check out this April Fools' video by {channel}.\n\n{url}")


def setup(bot: Bot) -> None:
    """Load the April Fools' Cog."""
    bot.add_cog(AprilFoolVideos())