mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Add message_content intent and move to api v10
This commit is contained in:
parent
b1571ccc25
commit
37f96e3473
@ -514,6 +514,7 @@ class Intents(BaseFlags):
|
|||||||
self = cls.all()
|
self = cls.all()
|
||||||
self.presences = False
|
self.presences = False
|
||||||
self.members = False
|
self.members = False
|
||||||
|
self.message_content = False
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@flag_value
|
@flag_value
|
||||||
@ -892,6 +893,33 @@ class Intents(BaseFlags):
|
|||||||
"""
|
"""
|
||||||
return 1 << 14
|
return 1 << 14
|
||||||
|
|
||||||
|
@flag_value
|
||||||
|
def message_content(self):
|
||||||
|
""":class:`bool`: Whether message content, attachments, embeds and components will be available in messages
|
||||||
|
which do not meet the following criteria:
|
||||||
|
|
||||||
|
- The message was sent by the client
|
||||||
|
- The message was sent in direct messages
|
||||||
|
- The message mentions the client
|
||||||
|
|
||||||
|
This applies to the following events:
|
||||||
|
|
||||||
|
- :func:`on_message`
|
||||||
|
- :func:`on_message_edit`
|
||||||
|
- :func:`on_message_delete`
|
||||||
|
- :func:`on_raw_message_edit`
|
||||||
|
|
||||||
|
For more information go to the :ref:`message content intent documentation <need_message_content_intent>`.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Currently, this requires opting in explicitly via the developer portal as well.
|
||||||
|
Bots in over 100 guilds will need to apply to Discord for verification.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
"""
|
||||||
|
return 1 << 15
|
||||||
|
|
||||||
|
|
||||||
@fill_with_flags()
|
@fill_with_flags()
|
||||||
class MemberCacheFlags(BaseFlags):
|
class MemberCacheFlags(BaseFlags):
|
||||||
|
@ -260,7 +260,7 @@ def handle_message_parameters(
|
|||||||
|
|
||||||
|
|
||||||
class Route:
|
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:
|
def __init__(self, method: str, path: str, **parameters: Any) -> None:
|
||||||
self.path: str = path
|
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]:
|
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)
|
r = Route('DELETE', '/guilds/{guild_id}/members/{user_id}', guild_id=guild_id, user_id=user_id)
|
||||||
if reason:
|
return self.request(r, reason=reason)
|
||||||
# thanks aiohttp
|
|
||||||
r.url = f'{r.url}?reason={_uriquote(reason)}'
|
|
||||||
|
|
||||||
return self.request(r)
|
|
||||||
|
|
||||||
def ban(
|
def ban(
|
||||||
self,
|
self,
|
||||||
@ -1941,9 +1937,9 @@ class HTTPClient:
|
|||||||
except HTTPException as exc:
|
except HTTPException as exc:
|
||||||
raise GatewayNotFound() from exc
|
raise GatewayNotFound() from exc
|
||||||
if zlib:
|
if zlib:
|
||||||
value = '{0}?encoding={1}&v=9&compress=zlib-stream'
|
value = '{0}?encoding={1}&v=10&compress=zlib-stream'
|
||||||
else:
|
else:
|
||||||
value = '{0}?encoding={1}&v=9'
|
value = '{0}?encoding={1}&v=10'
|
||||||
return value.format(data['url'], encoding)
|
return value.format(data['url'], encoding)
|
||||||
|
|
||||||
async def get_bot_gateway(self, *, encoding: str = 'json', zlib: bool = True) -> Tuple[int, str]:
|
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
|
raise GatewayNotFound() from exc
|
||||||
|
|
||||||
if zlib:
|
if zlib:
|
||||||
value = '{0}?encoding={1}&v=9&compress=zlib-stream'
|
value = '{0}?encoding={1}&v=10&compress=zlib-stream'
|
||||||
else:
|
else:
|
||||||
value = '{0}?encoding={1}&v=9'
|
value = '{0}?encoding={1}&v=10'
|
||||||
return data['shards'], value.format(data['url'], encoding)
|
return data['shards'], value.format(data['url'], encoding)
|
||||||
|
|
||||||
def get_user(self, user_id: Snowflake) -> Response[user.User]:
|
def get_user(self, user_id: Snowflake) -> Response[user.User]:
|
||||||
|
@ -107,6 +107,17 @@ Member Intent
|
|||||||
- Whether you want to request the guild member list through :meth:`Guild.chunk` or :meth:`Guild.fetch_members`.
|
- Whether you want to request the guild member list through :meth:`Guild.chunk` or :meth:`Guild.fetch_members`.
|
||||||
- Whether you want high accuracy member cache under :attr:`Guild.members`.
|
- Whether you want high accuracy member cache under :attr:`Guild.members`.
|
||||||
|
|
||||||
|
.. _need_message_content_intent:
|
||||||
|
|
||||||
|
Message Content
|
||||||
|
+++++++++++++++++
|
||||||
|
|
||||||
|
- Whether you use :attr:`Message.content` to check message content.
|
||||||
|
- Whether you use :attr:`Message.attachments` to check message attachments.
|
||||||
|
- Whether you use :attr:`Message.embeds` to check message embeds.
|
||||||
|
- Whether you use :attr:`Message.components` to check message components.
|
||||||
|
- Whether you use the commands extension with a non-mentioning prefix.
|
||||||
|
|
||||||
.. _intents_member_cache:
|
.. _intents_member_cache:
|
||||||
|
|
||||||
Member Cache
|
Member Cache
|
||||||
|
Loading…
x
Reference in New Issue
Block a user