aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-02-15 11:22:29 -0800
committerGravatar MarkKoz <[email protected]>2020-02-15 11:23:41 -0800
commit6b689a15be69120a775789892f155c736926ef07 (patch)
tree351b92f1e50f7fc909649998203d2482002d5ae4
parentBot: move connector/session recreation to a separate function (diff)
Bot: call _recreate() in clear()
Because discord.py recreates the HTTPClient session, may as well follow suite and recreate our own stuff here too.
-rw-r--r--bot/bot.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/bot/bot.py b/bot/bot.py
index e1b1d81dc..9f48c980c 100644
--- a/bot/bot.py
+++ b/bot/bot.py
@@ -37,8 +37,14 @@ class Bot(commands.Bot):
log.info(f"Cog loaded: {cog.qualified_name}")
def clear(self) -> None:
- """Clears the internal state of the bot and sets the HTTPClient connector to None."""
- self.http.connector = None # Use the default connector.
+ """
+ Clears the internal state of the bot and recreates the connector and sessions.
+
+ Will cause a DeprecationWarning if called outside a coroutine.
+ """
+ # Because discord.py recreates the HTTPClient session, may as well follow suite and recreate
+ # our own stuff here too.
+ self._recreate()
super().clear()
async def close(self) -> None: