From 8fc2ff954fbdfead73825f13d95a876fea5588a3 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Tue, 23 Aug 2022 21:50:40 +0100 Subject: Move init tasks to async cog_load functions --- bot/exts/fun/game.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'bot/exts/fun/game.py') diff --git a/bot/exts/fun/game.py b/bot/exts/fun/game.py index 56e6314f..4ed2e93e 100644 --- a/bot/exts/fun/game.py +++ b/bot/exts/fun/game.py @@ -185,9 +185,7 @@ class Games(Cog): self.genres: dict[str, int] = {} self.headers = BASE_HEADERS - self.bot.loop.create_task(self.renew_access_token()) - - async def renew_access_token(self) -> None: + async def cog_load(self) -> None: """Refeshes V4 access token a number of seconds before expiry. See `ACCESS_TOKEN_RENEWAL_WINDOW`.""" while True: async with self.http_session.post(OAUTH_URL, params=OAUTH_PARAMS) as resp: -- cgit v1.2.3