Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions discord/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,13 @@ def none(cls) -> Self:

@classmethod
def default(cls) -> Self:
"""A factory method that creates a :class:`Intents` with everything enabled
except :attr:`presences` and :attr:`members`.
r"""A factory method that creates a :class:`Intents` with everything enabled
except :attr:`presences`\, :attr:`members` and :attr:`message_content`.
"""
self = cls.all()
self.presences = False
self.members = False
self.message_content = False
return self

@flag_value
Expand Down Expand Up @@ -901,6 +902,35 @@ def dm_typing(self):
"""
return 1 << 14

@flag_value
def message_content(self):
""":class:`bool`: Whether to receive the following attributes of messages:

- :attr:`Message.content`
- :attr:`Message.embeds`
- :attr:`Message.attachments`
- :attr:`Message.components`

This means that these attributes will be set to an empty string or list depending
on the type of the attribute.

The bot will still receive these attributes if:

- The message was sent by the bot
- The message was sent in the bot's DMs
- The message mentions the bot

These restrictions do not apply to messages received via interactions.

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.
"""
return 1 << 15

@flag_value
def scheduled_events(self):
""":class:`bool`: Whether scheduled event related events are enabled.
Expand Down
14 changes: 7 additions & 7 deletions discord/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async def json_or_text(response: aiohttp.ClientResponse) -> Union[Dict[str, Any]


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
Expand Down Expand Up @@ -2056,10 +2056,10 @@ async def get_gateway(self, *, encoding: str = 'json', zlib: bool = True) -> str
except HTTPException as exc:
raise GatewayNotFound() from exc
if zlib:
value = '{0}?encoding={1}&v=9&compress=zlib-stream'
value = '{0}?encoding={1}&v={2}&compress=zlib-stream'
else:
value = '{0}?encoding={1}&v=9'
return value.format(data['url'], encoding)
value = '{0}?encoding={1}&v={2}'
return value.format(data['url'], encoding, 10)

async def get_bot_gateway(self, *, encoding: str = 'json', zlib: bool = True) -> Tuple[int, str]:
try:
Expand All @@ -2068,10 +2068,10 @@ async def get_bot_gateway(self, *, encoding: str = 'json', zlib: bool = True) ->
raise GatewayNotFound() from exc

if zlib:
value = '{0}?encoding={1}&v=9&compress=zlib-stream'
value = '{0}?encoding={1}&v={2}&compress=zlib-stream'
else:
value = '{0}?encoding={1}&v=9'
return data['shards'], value.format(data['url'], encoding)
value = '{0}?encoding={1}&v={2}'
return data['shards'], value.format(data['url'], encoding, 10)

def get_user(self, user_id: Snowflake) -> Response[user.User]:
return self.request(Route('GET', '/users/{user_id}', user_id=user_id))
Expand Down
30 changes: 30 additions & 0 deletions docs/intents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,36 @@ Member Intent

.. _intents_member_cache:

.. need_message_content_intent:

Message Content Intent
++++++++++++++++++++++++

- Whether you have access to any of the following attributes:

* :attr:`Message.content`
* :attr:`Message.embeds`
* :attr:`Message.attachments`
* :attr:`Message.components`

This means that these attributes will be set to an empty string or list depending
on the type of the attribute.

The bot will still receive these attributes if:

- The message was sent by the bot
- The message was sent in the bot's DMs
- The message mentions the bot

These restrictions do not apply to messages received via interactions.

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.

Member Cache
-------------

Expand Down