Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discord forwards updated #16

Open
wants to merge 4 commits into
base: discord-proxy
Choose a base branch
from
Open
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
23 changes: 17 additions & 6 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1489,8 +1489,8 @@ async def send(
.. 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
A reference to the :class:`~discord.Message` you are replying to or forwarding, this can be created using
:meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. When replying, 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``.
Expand Down Expand Up @@ -1577,9 +1577,20 @@ async def send(
allowed_mentions = allowed_mentions or AllowedMentions().to_dict()
allowed_mentions["replied_user"] = bool(mention_author)

_reference = None

if reference is not None:
try:
reference = reference.to_message_reference_dict()
_reference = reference.to_message_reference_dict()
from .message import MessageReference

if not isinstance(reference, MessageReference):
utils.warn_deprecated(
f"Passing {type(reference).__name__} to reference",
"MessageReference",
"2.7",
"3.0",
)
except AttributeError:
raise InvalidArgument(
"reference parameter must be Message, MessageReference, or"
Expand Down Expand Up @@ -1613,7 +1624,7 @@ async def send(
embed=embed,
embeds=embeds,
nonce=nonce,
message_reference=reference,
message_reference=_reference,
stickers=stickers,
components=components,
flags=flags,
Expand All @@ -1639,7 +1650,7 @@ async def send(
embeds=embeds,
nonce=nonce,
allowed_mentions=allowed_mentions,
message_reference=reference,
message_reference=_reference,
stickers=stickers,
components=components,
flags=flags,
Expand All @@ -1656,7 +1667,7 @@ async def send(
embeds=embeds,
nonce=nonce,
allowed_mentions=allowed_mentions,
message_reference=reference,
message_reference=_reference,
stickers=stickers,
components=components,
flags=flags,
Expand Down
12 changes: 12 additions & 0 deletions discord/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"AutoModKeywordPresetType",
"ApplicationRoleConnectionMetadataType",
"ReactionType",
"MessageReferenceType",
)


Expand Down Expand Up @@ -257,6 +258,7 @@ class MessageType(Enum):
stage_raise_hand = 30
stage_topic = 31
guild_application_premium_subscription = 32
poll_result = 46


class VoiceRegion(Enum):
Expand Down Expand Up @@ -952,6 +954,16 @@ class ReactionType(Enum):
burst = 1



class MessageReferenceType(Enum):
"""The message reference's type"""

default = 0
forward = 1




T = TypeVar("T")


Expand Down
Loading
Loading