Fix silly recursive error
This commit is contained in:
parent
8fb4fa5295
commit
0446d7a117
2 changed files with 4 additions and 5 deletions
|
@ -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(
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue