aboutsummaryrefslogtreecommitdiff
path: root/discord/http.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-12-16 21:36:39 -0500
committerRapptz <[email protected]>2017-12-16 21:36:39 -0500
commit5c5a59c18e41538bee44ed85b7cf1806e830623d (patch)
tree42a29138793346c93df4c8d0d97214619dc4a0ea /discord/http.py
parentUpdate README to point to new server. (diff)
downloaddiscord.py-5c5a59c18e41538bee44ed85b7cf1806e830623d.tar.xz
discord.py-5c5a59c18e41538bee44ed85b7cf1806e830623d.zip
Add Client.clear to clear the bot's internal state to a clean slate.
In case you want to have some external restart loop.
Diffstat (limited to 'discord/http.py')
-rw-r--r--discord/http.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/discord/http.py b/discord/http.py
index 70d47424..7ec64d82 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -102,6 +102,10 @@ class HTTPClient:
user_agent = 'DiscordBot (https://github.com/Rapptz/discord.py {0}) Python/{1[0]}.{1[1]} aiohttp/{2}'
self.user_agent = user_agent.format(__version__, sys.version_info, aiohttp.__version__)
+ def recreate(self):
+ if self._session.closed:
+ self._session = aiohttp.ClientSession(connector=self.connector, loop=self.loop)
+
@asyncio.coroutine
def request(self, route, *, header_bypass_delay=None, **kwargs):
bucket = route.bucket