diff options
author | 2019-12-08 01:40:19 -0800 | |
---|---|---|
committer | 2019-12-08 02:20:19 -0800 | |
commit | 56578525ac4e5c6d20392d1208b74623c8524bcd (patch) | |
tree | 037ec5f21ff426ad7270302c500abe0c5860f914 /tests | |
parent | Fix name conflict with the Bot cog (diff) |
Properly create and close aiohttp sessions
aiohttp throws a warning when a session is created outside of a running
async event loop. In aiohttp 4.0 this actually changes to an error
instead of merely a warning.
Since discord.py manages the event loop with client.run(), some of
the "internal" coroutines of the client were overwritten in the bot
subclass to be able to hook into when the bot starts and stops.
Sessions of both the bot and the API client can now potentially be None
if accessed before the sessions have been created. However, if called,
the API client's methods will wait for a session to be ready. It will
attempt to create a session as soon as the event loop starts (i.e. the
bot is running).
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions