diff options
| author | Rapptz <[email protected]> | 2021-04-10 23:24:44 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-04-11 00:39:13 -0400 |
| commit | d85805ab6d7a077db303c2bf1670c4948455f3ab (patch) | |
| tree | 0b1fe33a616f5bd8e4a030d9633014223d5bd15b /discord/http.py | |
| parent | [commands] use __args__ and __origin__ where applicable (diff) | |
| download | discord.py-d85805ab6d7a077db303c2bf1670c4948455f3ab.tar.xz discord.py-d85805ab6d7a077db303c2bf1670c4948455f3ab.zip | |
First pass at supporting v8 API
Diffstat (limited to 'discord/http.py')
| -rw-r--r-- | discord/http.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/discord/http.py b/discord/http.py index 1c7030f2..b32cc917 100644 --- a/discord/http.py +++ b/discord/http.py @@ -51,7 +51,7 @@ async def json_or_text(response): class Route: - BASE = 'https://discord.com/api/v7' + BASE = 'https://discord.com/api/v8' def __init__(self, method, path, **parameters): self.path = path @@ -151,7 +151,6 @@ class HTTPClient: # header creation headers = { 'User-Agent': self.user_agent, - 'X-Ratelimit-Precision': 'millisecond', } if self.token is not None: @@ -450,7 +449,7 @@ class HTTPClient: return self.request(r, reason=reason) def delete_messages(self, channel_id, message_ids, *, reason=None): - r = Route('POST', '/channels/{channel_id}/messages/bulk_delete', channel_id=channel_id) + r = Route('POST', '/channels/{channel_id}/messages/bulk-delete', channel_id=channel_id) payload = { 'messages': message_ids, } @@ -1279,28 +1278,28 @@ class HTTPClient: def application_info(self): return self.request(Route('GET', '/oauth2/applications/@me')) - async def get_gateway(self, *, encoding='json', v=6, zlib=True): + async def get_gateway(self, *, encoding='json', zlib=True): try: data = await self.request(Route('GET', '/gateway')) except HTTPException as exc: raise GatewayNotFound() from exc if zlib: - value = '{0}?encoding={1}&v={2}&compress=zlib-stream' + value = '{0}?encoding={1}&v=8&compress=zlib-stream' else: - value = '{0}?encoding={1}&v={2}' - return value.format(data['url'], encoding, v) + value = '{0}?encoding={1}&v=8' + return value.format(data['url'], encoding) - async def get_bot_gateway(self, *, encoding='json', v=6, zlib=True): + async def get_bot_gateway(self, *, encoding='json', zlib=True): try: data = await self.request(Route('GET', '/gateway/bot')) except HTTPException as exc: raise GatewayNotFound() from exc if zlib: - value = '{0}?encoding={1}&v={2}&compress=zlib-stream' + value = '{0}?encoding={1}&v=8&compress=zlib-stream' else: - value = '{0}?encoding={1}&v={2}' - return data['shards'], value.format(data['url'], encoding, v) + value = '{0}?encoding={1}&v=8' + return data['shards'], value.format(data['url'], encoding) def get_user(self, user_id): return self.request(Route('GET', '/users/{user_id}', user_id=user_id)) |