diff --git a/discord/message.py b/discord/message.py index 8d812bb4b..dc7387a76 100644 --- a/discord/message.py +++ b/discord/message.py @@ -1298,12 +1298,18 @@ class Message(PartialMessage, Hashable): :attr:`MessageType.role_subscription_purchase` message. .. versionadded:: 2.0 - guild: Optional[:class:`Guild`] - The guild that the message belongs to, if applicable. application_id: Optional[:class:`int`] - The application that sent this message, if applicable. + The application ID of the application that created this message if this + message was sent by an application-owned webhook or an interaction. .. versionadded:: 2.0 + position: Optional[:class:`int`] + A generally increasing integer with potentially gaps or duplicates that represents + the approximate position of the message in a thread. + + .. versionadded:: 2.0 + guild: Optional[:class:`Guild`] + The guild that the message belongs to, if applicable. interaction: Optional[:class:`Interaction`] The interaction that this message is a response to. @@ -1321,7 +1327,6 @@ class Message(PartialMessage, Hashable): 'tts', 'content', 'webhook_id', - 'application_id', 'mention_everyone', 'embeds', 'mentions', @@ -1341,6 +1346,8 @@ class Message(PartialMessage, Hashable): 'call', 'interaction', 'role_subscription', + 'application_id', + 'position', ) if TYPE_CHECKING: @@ -1363,7 +1370,6 @@ class Message(PartialMessage, Hashable): self.id: int = int(data['id']) self._state: ConnectionState = state self.webhook_id: Optional[int] = utils._get_as_snowflake(data, 'webhook_id') - self.application_id: Optional[int] = utils._get_as_snowflake(data, 'application_id') self.reactions: List[Reaction] = [Reaction(message=self, data=d) for d in data.get('reactions', [])] self.attachments: List[Attachment] = [Attachment(data=a, state=self._state) for a in data['attachments']] self.embeds: List[Embed] = [Embed.from_dict(a) for a in data['embeds']] @@ -1376,6 +1382,8 @@ class Message(PartialMessage, Hashable): self.tts: bool = data['tts'] self.content: str = data['content'] self.nonce: Optional[Union[int, str]] = data.get('nonce') + self.position: Optional[int] = data.get('position') + self.application_id: Optional[int] = utils._get_as_snowflake(data, 'application_id') self.stickers: List[StickerItem] = [StickerItem(data=d, state=state) for d in data.get('sticker_items', [])] self.call: Optional[CallMessage] = None diff --git a/discord/types/message.py b/discord/types/message.py index 3217f7042..05205c6c5 100644 --- a/discord/types/message.py +++ b/discord/types/message.py @@ -126,6 +126,7 @@ class Message(PartialMessage): referenced_message: NotRequired[Optional[Message]] interaction: NotRequired[MessageInteraction] components: NotRequired[List[Component]] + position: NotRequired[int] role_subscription_data: NotRequired[RoleSubscriptionData]