diff options
author | 2022-08-23 21:50:40 +0100 | |
---|---|---|
committer | 2022-09-21 23:02:57 +0100 | |
commit | 8fc2ff954fbdfead73825f13d95a876fea5588a3 (patch) | |
tree | 7915b736a4b44a8389002e862bb94d4899c36bda /bot/exts/utilities/reddit.py | |
parent | Add dependabot config (diff) |
Move init tasks to async cog_load functions
Diffstat (limited to 'bot/exts/utilities/reddit.py')
-rw-r--r-- | bot/exts/utilities/reddit.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/bot/exts/utilities/reddit.py b/bot/exts/utilities/reddit.py index d6148abd..07222d79 100644 --- a/bot/exts/utilities/reddit.py +++ b/bot/exts/utilities/reddit.py @@ -38,16 +38,15 @@ class Reddit(Cog): self.access_token = None self.client_auth = BasicAuth(RedditConfig.client_id, RedditConfig.secret) - bot.loop.create_task(self.init_reddit_ready()) self.auto_poster_loop.start() - def cog_unload(self) -> None: + async def cog_unload(self) -> None: """Stop the loop task and revoke the access token when the cog is unloaded.""" self.auto_poster_loop.cancel() if self.access_token and self.access_token.expires_at > datetime.utcnow(): asyncio.create_task(self.revoke_access_token()) - async def init_reddit_ready(self) -> None: + async def cog_load(self) -> None: """Sets the reddit webhook when the cog is loaded.""" await self.bot.wait_until_guild_available() if not self.webhook: |