Fix silly recursive error

This commit is contained in:
JelNiSław 2022-03-31 18:24:06 +02:00
parent 8fb4fa5295
commit 0446d7a117
No known key found for this signature in database
GPG key ID: EA41571A0A88E97E
2 changed files with 4 additions and 5 deletions

View file

@ -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(

View file

@ -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()