diff options
author | 2021-05-15 23:41:20 +0200 | |
---|---|---|
committer | 2021-05-15 23:41:20 +0200 | |
commit | e6e280cd13236647ffcaa35f522baeb747fbf97e (patch) | |
tree | a888762bcd97704f57ad33e8e1bd0d179c3abd2b /bot/exts/evergreen/speedrun.py | |
parent | Merge pull request #737 from python-discord/latex-don't-load-cog (diff) | |
parent | chore: Apply Iceman's suggestions (diff) |
Spring cleanup (#718)
This PR changes a ton of various different bits and pieces. Please see #718 for more information.
Diffstat (limited to 'bot/exts/evergreen/speedrun.py')
-rw-r--r-- | bot/exts/evergreen/speedrun.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/bot/exts/evergreen/speedrun.py b/bot/exts/evergreen/speedrun.py index 21aad5aa..774eff81 100644 --- a/bot/exts/evergreen/speedrun.py +++ b/bot/exts/evergreen/speedrun.py @@ -5,23 +5,22 @@ from random import choice from discord.ext import commands +from bot.bot import Bot + log = logging.getLogger(__name__) -with Path('bot/resources/evergreen/speedrun_links.json').open(encoding="utf8") as file: - LINKS = json.load(file) + +LINKS = json.loads(Path("bot/resources/evergreen/speedrun_links.json").read_text("utf8")) 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: +def setup(bot: Bot) -> None: """Load the Speedrun cog.""" - bot.add_cog(Speedrun(bot)) + bot.add_cog(Speedrun()) |