Skip to content

Commit bafdc6d

Browse files
committed
only start aiohttp session in the asyncio loop context. add docs to explain fancy_login Closes #111
1 parent 3f5d749 commit bafdc6d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pyborg/pyborg/mod/mod_discord.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def __attrs_post_init__(self) -> None:
6060
raise NotImplementedError
6161
else:
6262
self.pyborg = None
63-
self.aio_session = aiohttp.ClientSession()
6463
super().__init__(loop=self.loop) # this might create a asyncio.loop!
6564

6665
def our_start(self) -> None:
@@ -73,12 +72,14 @@ def our_start(self) -> None:
7372
logger.error("No Token. Set one in your conf file.")
7473

7574
async def fancy_login(self) -> None:
75+
"calls Client.login only! no command scan"
7676
if 'token' in self.settings['discord']:
7777
await self.login(self.settings['discord']['token'])
7878
else:
7979
logger.error("No Token. Set one in your conf file.")
8080

8181
async def on_ready(self) -> None:
82+
self.aio_session = aiohttp.ClientSession()
8283
print('Logged in as')
8384
print(self.user.name)
8485
print(self.user.id)

0 commit comments

Comments
 (0)