diff options
| author | 2019-08-13 19:31:04 -0400 | |
|---|---|---|
| committer | 2019-08-13 19:31:04 -0400 | |
| commit | fceb30cd8e9f346842eaed7b0d45001172ef1500 (patch) | |
| tree | 562b5d75f2098c09a41eb66f0d0b44db8341a645 /bot | |
| parent | Merge pull request #249 from python-discord/snakes-and-ladders-bytesio-fix (diff) | |
| parent | moved data grab to module level, changed var to constant (diff) | |
Merge pull request #254 from jakeHebert/master
Add speedrun cog and resource
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/resources/evergreen/speedrun_links.json | 18 | ||||
| -rw-r--r-- | bot/seasons/evergreen/speedrun.py | 28 | 
2 files changed, 46 insertions, 0 deletions
| diff --git a/bot/resources/evergreen/speedrun_links.json b/bot/resources/evergreen/speedrun_links.json new file mode 100644 index 00000000..acb5746a --- /dev/null +++ b/bot/resources/evergreen/speedrun_links.json @@ -0,0 +1,18 @@ + [ +        "https://www.youtube.com/watch?v=jNE28SDXdyQ", +        "https://www.youtube.com/watch?v=iI8Giq7zQDk", +        "https://www.youtube.com/watch?v=VqNnkqQgFbc", +        "https://www.youtube.com/watch?v=Gum4GI2Jr0s", +        "https://www.youtube.com/watch?v=5YHjHzHJKkU", +        "https://www.youtube.com/watch?v=X0pJSTy4tJI", +        "https://www.youtube.com/watch?v=aVFq0H6D6_M", +        "https://www.youtube.com/watch?v=1O6LuJbEbSI", +        "https://www.youtube.com/watch?v=Bgh30BiWG58", +        "https://www.youtube.com/watch?v=wwvgAAvhxM8", +        "https://www.youtube.com/watch?v=0TWQr0_fi80", +        "https://www.youtube.com/watch?v=hatqZby-0to", +        "https://www.youtube.com/watch?v=tmnMq2Hw72w", +        "https://www.youtube.com/watch?v=UTkyeTCAucA", +        "https://www.youtube.com/watch?v=67kQ3l-1qMs", +        "https://www.youtube.com/watch?v=14wqBA5Q1yc" +] diff --git a/bot/seasons/evergreen/speedrun.py b/bot/seasons/evergreen/speedrun.py new file mode 100644 index 00000000..f6a43a63 --- /dev/null +++ b/bot/seasons/evergreen/speedrun.py @@ -0,0 +1,28 @@ +import json +import logging +from pathlib import Path +from random import choice + +from discord.ext import commands + +log = logging.getLogger(__name__) +with Path('bot/resources/evergreen/speedrun_links.json').open(encoding="utf-8") as file: +    LINKS = json.load(file) + + +class Speedrun(commands.Cog): +    """Commands about the video game speedrunning community.""" + +    def __init__(self, bot): +        self.bot = bot + +    @commands.command(name="speedrun") +    async def get_speedrun(self, ctx): +        """Sends a link to a video of a random speedrun.""" +        await ctx.send(choice(LINKS)) + + +def setup(bot): +    """Load the Speedrun cog""" +    bot.add_cog(Speedrun(bot)) +    log.info("Speedrun cog loaded") | 
