aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/evergreen/speedrun.py
diff options
context:
space:
mode:
authorGravatar Eivind Teig <[email protected]>2020-04-02 14:39:24 +0200
committerGravatar GitHub <[email protected]>2020-04-02 14:39:24 +0200
commitd77a2bbc50305d05371197f4cfe3354cfca4c627 (patch)
treebe1eed54972d9843f66114311f93b68b579046ac /bot/exts/evergreen/speedrun.py
parentMerge pull request #382 from ks129/game-fuzzy (diff)
parentMerge master: adjust `Space` cog location (diff)
Merge pull request #329 from python-discord/seasonal-purge
Deseasonify: Make all cogs available year-round, and manage only branding by season.
Diffstat (limited to 'bot/exts/evergreen/speedrun.py')
-rw-r--r--bot/exts/evergreen/speedrun.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/bot/exts/evergreen/speedrun.py b/bot/exts/evergreen/speedrun.py
new file mode 100644
index 00000000..4e8d7aee
--- /dev/null
+++ b/bot/exts/evergreen/speedrun.py
@@ -0,0 +1,27 @@
+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: commands.Bot):
+ self.bot = bot
+
+ @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))
+
+
+def setup(bot: commands.Bot) -> None:
+ """Load the Speedrun cog."""
+ bot.add_cog(Speedrun(bot))