blob: c89ee5a05f4c83186ae2dbc42ef57766849726c7 (
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 random
from json import loads
from pathlib import Path
from discord.ext import commands
from pydis_core.utils.logging import get_logger
from bot.bot import Bot
log = get_logger(__name__)
ALL_VIDS = loads(Path("bot/resources/holidays/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}")
async def setup(bot: Bot) -> None:
"""Load the April Fools' Cog."""
await bot.add_cog(AprilFoolVideos())
|