Add message_content intent and move to api v10

This commit is contained in:
Josh
2022-02-18 23:44:46 +10:00
committed by GitHub
parent b1571ccc25
commit 37f96e3473
3 changed files with 45 additions and 10 deletions

View File

@@ -260,7 +260,7 @@ def handle_message_parameters(
class Route:
BASE: ClassVar[str] = 'https://discord.com/api/v8'
BASE: ClassVar[str] = 'https://discord.com/api/v10'
def __init__(self, method: str, path: str, **parameters: Any) -> None:
self.path: str = path
@@ -738,11 +738,7 @@ class HTTPClient:
def kick(self, user_id: Snowflake, guild_id: Snowflake, reason: Optional[str] = None) -> Response[None]:
r = Route('DELETE', '/guilds/{guild_id}/members/{user_id}', guild_id=guild_id, user_id=user_id)
if reason:
# thanks aiohttp
r.url = f'{r.url}?reason={_uriquote(reason)}'
return self.request(r)
return self.request(r, reason=reason)
def ban(
self,
@@ -1941,9 +1937,9 @@ class HTTPClient:
except HTTPException as exc:
raise GatewayNotFound() from exc
if zlib:
value = '{0}?encoding={1}&v=9&compress=zlib-stream'
value = '{0}?encoding={1}&v=10&compress=zlib-stream'
else:
value = '{0}?encoding={1}&v=9'
value = '{0}?encoding={1}&v=10'
return value.format(data['url'], encoding)
async def get_bot_gateway(self, *, encoding: str = 'json', zlib: bool = True) -> Tuple[int, str]:
@@ -1953,9 +1949,9 @@ class HTTPClient:
raise GatewayNotFound() from exc
if zlib:
value = '{0}?encoding={1}&v=9&compress=zlib-stream'
value = '{0}?encoding={1}&v=10&compress=zlib-stream'
else:
value = '{0}?encoding={1}&v=9'
value = '{0}?encoding={1}&v=10'
return data['shards'], value.format(data['url'], encoding)
def get_user(self, user_id: Snowflake) -> Response[user.User]: