Browse Source

Add PartialMessage to list of allowed message reference types

pull/7269/head
Lilly Rose Berner 4 years ago
committed by GitHub
parent
commit
5b8be9a772
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      discord/abc.py

18
discord/abc.py

@ -75,7 +75,7 @@ if TYPE_CHECKING:
from .member import Member from .member import Member
from .channel import CategoryChannel from .channel import CategoryChannel
from .embeds import Embed from .embeds import Embed
from .message import Message, MessageReference from .message import Message, MessageReference, PartialMessage
from .channel import TextChannel, DMChannel, GroupChannel from .channel import TextChannel, DMChannel, GroupChannel
from .threads import Thread from .threads import Thread
from .enums import InviteTarget from .enums import InviteTarget
@ -1162,7 +1162,7 @@ class Messageable:
delete_after: float = ..., delete_after: float = ...,
nonce: Union[str, int] = ..., nonce: Union[str, int] = ...,
allowed_mentions: AllowedMentions = ..., allowed_mentions: AllowedMentions = ...,
reference: Union[Message, MessageReference] = ..., reference: Union[Message, MessageReference, PartialMessage] = ...,
mention_author: bool = ..., mention_author: bool = ...,
view: View = ..., view: View = ...,
) -> Message: ) -> Message:
@ -1179,7 +1179,7 @@ class Messageable:
delete_after: float = ..., delete_after: float = ...,
nonce: Union[str, int] = ..., nonce: Union[str, int] = ...,
allowed_mentions: AllowedMentions = ..., allowed_mentions: AllowedMentions = ...,
reference: Union[Message, MessageReference] = ..., reference: Union[Message, MessageReference, PartialMessage] = ...,
mention_author: bool = ..., mention_author: bool = ...,
view: View = ..., view: View = ...,
) -> Message: ) -> Message:
@ -1196,7 +1196,7 @@ class Messageable:
delete_after: float = ..., delete_after: float = ...,
nonce: Union[str, int] = ..., nonce: Union[str, int] = ...,
allowed_mentions: AllowedMentions = ..., allowed_mentions: AllowedMentions = ...,
reference: Union[Message, MessageReference] = ..., reference: Union[Message, MessageReference, PartialMessage] = ...,
mention_author: bool = ..., mention_author: bool = ...,
view: View = ..., view: View = ...,
) -> Message: ) -> Message:
@ -1213,7 +1213,7 @@ class Messageable:
delete_after: float = ..., delete_after: float = ...,
nonce: Union[str, int] = ..., nonce: Union[str, int] = ...,
allowed_mentions: AllowedMentions = ..., allowed_mentions: AllowedMentions = ...,
reference: Union[Message, MessageReference] = ..., reference: Union[Message, MessageReference, PartialMessage] = ...,
mention_author: bool = ..., mention_author: bool = ...,
view: View = ..., view: View = ...,
) -> Message: ) -> Message:
@ -1282,7 +1282,7 @@ class Messageable:
.. versionadded:: 1.4 .. versionadded:: 1.4
reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`] 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 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 :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` whether this mentions the author of the referenced message using the :attr:`~discord.AllowedMentions.replied_user`
@ -1311,8 +1311,8 @@ class Messageable:
The ``files`` list is not of the appropriate size, The ``files`` list is not of the appropriate size,
you specified both ``file`` and ``files``, you specified both ``file`` and ``files``,
or you specified both ``embed`` and ``embeds``, or you specified both ``embed`` and ``embeds``,
or the ``reference`` object is not a :class:`~discord.Message` or the ``reference`` object is not a :class:`~discord.Message`,
or :class:`~discord.MessageReference`. :class:`~discord.MessageReference` or :class:`~discord.PartialMessage`.
Returns Returns
--------- ---------
@ -1351,7 +1351,7 @@ class Messageable:
try: try:
reference = reference.to_message_reference_dict() reference = reference.to_message_reference_dict()
except AttributeError: except AttributeError:
raise InvalidArgument('reference parameter must be Message or MessageReference') from None raise InvalidArgument('reference parameter must be Message, MessageReference, or PartialMessage') from None
if view: if view:
if not hasattr(view, '__discord_ui_view__'): if not hasattr(view, '__discord_ui_view__'):

Loading…
Cancel
Save