diff options
| author | Rapptz <[email protected]> | 2017-12-16 21:36:39 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-12-16 21:36:39 -0500 |
| commit | 5c5a59c18e41538bee44ed85b7cf1806e830623d (patch) | |
| tree | 42a29138793346c93df4c8d0d97214619dc4a0ea /discord/http.py | |
| parent | Update README to point to new server. (diff) | |
| download | discord.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.py | 4 |
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 |