aboutsummaryrefslogtreecommitdiff
path: root/discord/http.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-01-07 21:55:47 -0500
committerRapptz <[email protected]>2017-01-07 23:19:39 -0500
commit20041ea756305f20c86a621232639932c50f107c (patch)
treefc9be7da66b1dffd274d96f85dd1cb7c605e56c2 /discord/http.py
parentFix variable shadowing in READY parsing. (diff)
downloaddiscord.py-20041ea756305f20c86a621232639932c50f107c.tar.xz
discord.py-20041ea756305f20c86a621232639932c50f107c.zip
Implement AutoShardedClient for transparent sharding.
This allows people to run their >2,500 guild bot in a single process without the headaches of IPC/RPC or much difficulty.
Diffstat (limited to 'discord/http.py')
-rw-r--r--discord/http.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/discord/http.py b/discord/http.py
index 2b885dec..4e5410d0 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -588,5 +588,14 @@ class HTTPClient:
raise GatewayNotFound() from e
return data.get('url') + '?encoding=json&v=6'
+ @asyncio.coroutine
+ def get_bot_gateway(self):
+ try:
+ data = yield from self.get(self.GATEWAY + '/bot', bucket=_func_())
+ except HTTPException as e:
+ raise GatewayNotFound() from e
+ else:
+ return data['shards'], data['url'] + '?encoding=json&v=6'
+
def get_user_info(self, user_id):
return self.get('{0.USERS}/{1}'.format(self, user_id), bucket=_func_())