From 450476c8a8b5440b5ec40bf88fb26084abe74d3b Mon Sep 17 00:00:00 2001 From: profitroll Date: Sat, 10 Aug 2024 14:19:40 +0200 Subject: [PATCH] Resolves #87 --- classes/pyroclient.py | 9 +++++++-- requirements.txt | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/classes/pyroclient.py b/classes/pyroclient.py index c0d40e1..cdfb1e3 100644 --- a/classes/pyroclient.py +++ b/classes/pyroclient.py @@ -57,7 +57,7 @@ class PyroClient(PyroClient): self.config["bot"]["owner"] ] - self.sender_session = ClientSession() + self.sender_session: Union[ClientSession, None] = None self.scopes_placeholders: Dict[str, int] = { "owner": self.owner, @@ -67,6 +67,9 @@ class PyroClient(PyroClient): async def start(self): await super().start() + if self.sender_session is None: + self.sender_session = ClientSession() + if self.config["reports"]["update"]: try: async with ClientSession( @@ -134,7 +137,9 @@ class PyroClient(PyroClient): ) await http_session.close() - await self.sender_session.close() + + if self.sender_session is not None: + await self.sender_session.close() await super().stop() diff --git a/requirements.txt b/requirements.txt index 6846e77..b480b99 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -aiohttp~=3.9.1 +aiohttp~=3.10.2 async_pymongo==0.1.6 convopyro==0.5 pillow~=10.4.0