aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/fun/speedrun.py
blob: 3685b870752a5624c0e5a3250470a4e8ebfbc5e9 (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
import json
from pathlib import Path
from random import choice

from discord.ext import commands
from pydis_core.utils.logging import get_logger

from bot.bot import Bot

log = get_logger(__name__)

LINKS = json.loads(Path("bot/resources/fun/speedrun_links.json").read_text("utf8"))


class Speedrun(commands.Cog):
    """Commands about the video game speedrunning community."""

    @commands.command(name="speedrun")
    async def get_speedrun(self, ctx: commands.Context) -> None:
        """Sends a link to a video of a random speedrun."""
        await ctx.send(choice(LINKS))


async def setup(bot: Bot) -> None:
    """Load the Speedrun cog."""
    await bot.add_cog(Speedrun())