From 001ccc87d6157c553f8115e1180ffaddc5ee449a Mon Sep 17 00:00:00 2001 From: Steve C Date: Tue, 22 Oct 2024 12:01:34 -0400 Subject: [PATCH] Add Message.forward flag --- discord/abc.py | 9 +++++---- discord/flags.py | 10 +++++++++- discord/message.py | 8 +++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/discord/abc.py b/discord/abc.py index da0c96025..5fdcff130 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -1805,10 +1805,11 @@ class Messageable: .. versionadded:: 1.4 reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`, :class:`~discord.PartialMessage`] - A reference to the :class:`~discord.Message` to which you are replying, this can be created using - :meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control - whether this mentions the author of the referenced message using the :attr:`~discord.AllowedMentions.replied_user` - attribute of ``allowed_mentions`` or by setting ``mention_author``. + A reference to the :class:`~discord.Message` to which you are referencing, this can be created using + :meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. + In the event of a replying reference, you can control whether this mentions the author of the referenced + message using the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions`` or by + setting ``mention_author``. .. versionadded:: 1.6 diff --git a/discord/flags.py b/discord/flags.py index 99237cc23..65b1c164e 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -148,7 +148,7 @@ class BaseFlags: setattr(self, key, value) @classmethod - def _from_value(cls, value): + def _from_value(cls, value: int) -> Self: self = cls.__new__(cls) self.value = value return self @@ -674,6 +674,14 @@ class MessageFlags(BaseFlags): """ return 8192 + @flag_value + def forwarded(self): + """:class:`bool`: Returns ``True`` if the message is a forwarded message. + + .. versionadded:: 2.5 + """ + return 16384 + @fill_with_flags() class PublicUserFlags(BaseFlags): diff --git a/discord/message.py b/discord/message.py index 3fe84ee43..91c563d4f 100644 --- a/discord/message.py +++ b/discord/message.py @@ -620,7 +620,7 @@ class MessageReference: guild_id: Optional[:class:`int`] The guild id of the message referenced. fail_if_not_exists: :class:`bool` - Whether replying to the referenced message should raise :class:`HTTPException` + Whether the referenced message should raise :class:`HTTPException` if the message no longer exists or Discord could not fetch the message. .. versionadded:: 1.7 @@ -632,8 +632,6 @@ class MessageReference: If the message was resolved at a prior point but has since been deleted then this will be of type :class:`DeletedReferencedMessage`. - Currently, this is mainly the replied to message when a user replies to a message. - .. versionadded:: 1.6 """ @@ -685,7 +683,7 @@ class MessageReference: message: :class:`~discord.Message` The message to be converted into a reference. fail_if_not_exists: :class:`bool` - Whether replying to the referenced message should raise :class:`HTTPException` + Whether the referenced message should raise :class:`HTTPException` if the message no longer exists or Discord could not fetch the message. .. versionadded:: 1.7 @@ -1654,7 +1652,7 @@ class PartialMessage(Hashable): Parameters ---------- fail_if_not_exists: :class:`bool` - Whether replying using the message reference should raise :class:`HTTPException` + Whether the referenced message should raise :class:`HTTPException` if the message no longer exists or Discord could not fetch the message. .. versionadded:: 1.7