aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/fun/speedrun.py
diff options
context:
space:
mode:
authorGravatar brad90four <[email protected]>2021-09-07 07:34:57 -0400
committerGravatar brad90four <[email protected]>2021-09-07 07:34:57 -0400
commit1e711f3e04c6e6adb66159ffbdc4f72740b62fd7 (patch)
treeaf1eae3a95b557ee27cf7577b67b8fecf90b1752 /bot/exts/fun/speedrun.py
parentAdded ryanzec_colours.json constructed from ryanzec/name-that-color (diff)
parentContinue work in progress (diff)
Fixing merge conflicts
Diffstat (limited to 'bot/exts/fun/speedrun.py')
-rw-r--r--bot/exts/fun/speedrun.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/bot/exts/fun/speedrun.py b/bot/exts/fun/speedrun.py
new file mode 100644
index 00000000..c2966ce1
--- /dev/null
+++ b/bot/exts/fun/speedrun.py
@@ -0,0 +1,26 @@
+import json
+import logging
+from pathlib import Path
+from random import choice
+
+from discord.ext import commands
+
+from bot.bot import Bot
+
+log = logging.getLogger(__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))
+
+
+def setup(bot: Bot) -> None:
+ """Load the Speedrun cog."""
+ bot.add_cog(Speedrun())