Skip to content

Commit

Permalink
first set of updates regarding library
Browse files Browse the repository at this point in the history
  • Loading branch information
yashpaliwal-bst authored and yashpaliwal-bst committed Oct 8, 2024
1 parent 2a647ab commit a5122ee
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 16 deletions.
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
21 changes: 21 additions & 0 deletions discord/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
"AutoModKeywordPresetType",
"ApplicationRoleConnectionMetadataType",
"ReactionType",
"PollLayoutType",
"MessageReferenceType",
)


Expand Down Expand Up @@ -257,6 +259,12 @@ class MessageType(Enum):
stage_raise_hand = 30
stage_topic = 31
guild_application_premium_subscription = 32
guild_incident_alert_mode_enabled = 36
guild_incident_alert_mode_disabled = 37
guild_incident_report_raid = 38
guild_incident_report_false_alarm = 39
purchase_notification = 44
poll_result = 46


class VoiceRegion(Enum):
Expand Down Expand Up @@ -951,6 +959,19 @@ class ReactionType(Enum):
normal = 0
burst = 1

class PollLayoutType(Enum):
"""The poll's layout type."""
default = 1


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

default = 0
forward = 1




T = TypeVar("T")

Expand Down
Loading

0 comments on commit a5122ee

Please sign in to comment.