diff --git a/wulkabot/cogs/github.py b/wulkabot/cogs/github.py index 13b8f39..cf0cc77 100644 --- a/wulkabot/cogs/github.py +++ b/wulkabot/cogs/github.py @@ -6,7 +6,6 @@ Copyright (C) 2022-present Stanisław Jelnicki import re from typing import Any -import aiohttp import discord from discord.ext import commands @@ -25,7 +24,7 @@ class GitHub(commands.Cog): def __init__(self, bot: bot.Wulkabot) -> None: super().__init__() self.bot = bot - self.github = github.GitHub(aiohttp.ClientSession(base_url="https://api.github.com")) + self.github = github.GitHub() async def cog_load(self) -> None: result = await self.bot.http_client.get( diff --git a/wulkabot/utils/github.py b/wulkabot/utils/github.py index 536e40c..a675115 100644 --- a/wulkabot/utils/github.py +++ b/wulkabot/utils/github.py @@ -9,8 +9,8 @@ import aiohttp class GitHub: - def __init__(self, http_client: aiohttp.ClientSession) -> None: - self._http = http_client + def __init__(self) -> None: + self._http = aiohttp.ClientSession(base_url="https://api.github.com") async def fetch_repo(self, owner: str, repo: str) -> dict[str, Any] | None: response = await self._http.get(f"/repos/{owner}/{repo}") @@ -18,4 +18,4 @@ class GitHub: return await response.json() async def close(self): - await self.close() + await self._http.close()