Skip to content

Commit 53486fe

Browse files
authored
Merge branch 'master' into soundboard
Signed-off-by: Paillat <[email protected]>
2 parents e1d141f + a140c3a commit 53486fe

File tree

11 files changed

+324
-28
lines changed

11 files changed

+324
-28
lines changed

CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ These changes are available on the `master` branch, but have not yet been releas
5858
([#2623](https://github.com/Pycord-Development/pycord/pull/2623))
5959
- Added new `Subscription` object and related methods/events.
6060
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
61+
- Added `Message.forward_to`, `Message.snapshots`, and other related attributes.
62+
([#2598](https://github.com/Pycord-Development/pycord/pull/2598))
6163
- Added the ability to change the API's base URL with `Route.API_BASE_URL`.
6264
([#2714](https://github.com/Pycord-Development/pycord/pull/2714))
6365
- Added the ability to pass a `datetime.time` object to `format_dt`
@@ -108,14 +110,16 @@ These changes are available on the `master` branch, but have not yet been releas
108110
([#2564](https://github.com/Pycord-Development/pycord/pull/2564))
109111
- Fixed `Subscription.renewal_sku_ids` not accepting `None` from the received payload.
110112
([#2709](https://github.com/Pycord-Development/pycord/pull/2709))
111-
- Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`
113+
- Fixed `ForumChannel.edit` allowing `default_reaction_emoji` to be `None`.
112114
([#2739](https://github.com/Pycord-Development/pycord/pull/2739))
113115
- Fixed missing `None` type hints in `Select.__init__`.
114-
([#2746])(https://github.com/Pycord-Development/pycord/pull/2746)
116+
([#2746](https://github.com/Pycord-Development/pycord/pull/2746))
115117
- Updated `valid_locales` to support `in` and `es-419`.
116-
([#2767])(https://github.com/Pycord-Development/pycord/pull/2767)
118+
([#2767](https://github.com/Pycord-Development/pycord/pull/2767))
117119
- Fixed `Webhook.edit` not working with `attachments=[]`.
118-
([#2779])(https://github.com/Pycord-Development/pycord/pull/2779)
120+
([#2779](https://github.com/Pycord-Development/pycord/pull/2779))
121+
- Fixed GIF-based `Sticker` returning the wrong `url`.
122+
([#2781](https://github.com/Pycord-Development/pycord/pull/2781))
119123

120124
### Changed
121125

discord/abc.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,9 +1497,9 @@ async def send(
14971497
.. versionadded:: 1.4
14981498
14991499
reference: Union[:class:`~discord.Message`, :class:`~discord.MessageReference`, :class:`~discord.PartialMessage`]
1500-
A reference to the :class:`~discord.Message` to which you are replying, this can be created using
1501-
:meth:`~discord.Message.to_reference` or passed directly as a :class:`~discord.Message`. You can control
1502-
whether this mentions the author of the referenced message using the
1500+
A reference to the :class:`~discord.Message` being replied to or forwarded. This can be created using
1501+
:meth:`~discord.Message.to_reference`.
1502+
When replying, you can control whether this mentions the author of the referenced message using the
15031503
:attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions`` or by
15041504
setting ``mention_author``.
15051505
@@ -1589,9 +1589,19 @@ async def send(
15891589
allowed_mentions = allowed_mentions or AllowedMentions().to_dict()
15901590
allowed_mentions["replied_user"] = bool(mention_author)
15911591

1592+
_reference = None
15921593
if reference is not None:
15931594
try:
1594-
reference = reference.to_message_reference_dict()
1595+
_reference = reference.to_message_reference_dict()
1596+
from .message import MessageReference
1597+
1598+
if not isinstance(reference, MessageReference):
1599+
utils.warn_deprecated(
1600+
f"Passing {type(reference).__name__} to reference",
1601+
"MessageReference",
1602+
"2.7",
1603+
"3.0",
1604+
)
15951605
except AttributeError:
15961606
raise InvalidArgument(
15971607
"reference parameter must be Message, MessageReference, or"
@@ -1641,7 +1651,7 @@ async def send(
16411651
nonce=nonce,
16421652
enforce_nonce=enforce_nonce,
16431653
allowed_mentions=allowed_mentions,
1644-
message_reference=reference,
1654+
message_reference=_reference,
16451655
stickers=stickers,
16461656
components=components,
16471657
flags=flags.value,
@@ -1660,7 +1670,7 @@ async def send(
16601670
nonce=nonce,
16611671
enforce_nonce=enforce_nonce,
16621672
allowed_mentions=allowed_mentions,
1663-
message_reference=reference,
1673+
message_reference=_reference,
16641674
stickers=stickers,
16651675
components=components,
16661676
flags=flags.value,

discord/channel.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3444,6 +3444,9 @@ def get_partial_message(self, message_id: int, /) -> PartialMessage:
34443444

34453445
return PartialMessage(channel=self, id=message_id)
34463446

3447+
def __repr__(self) -> str:
3448+
return f"<PartialMessageable id={self.id} type={self.type!r}>"
3449+
34473450

34483451
class VoiceChannelEffectAnimation(NamedTuple):
34493452
"""Represents an animation that can be sent to a voice channel.

discord/enums.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
"EntitlementOwnerType",
7878
"IntegrationType",
7979
"InteractionContextType",
80+
"PollLayoutType",
81+
"MessageReferenceType",
8082
)
8183

8284

@@ -267,6 +269,12 @@ class MessageType(Enum):
267269
stage_raise_hand = 30
268270
stage_topic = 31
269271
guild_application_premium_subscription = 32
272+
guild_incident_alert_mode_enabled = 36
273+
guild_incident_alert_mode_disabled = 37
274+
guild_incident_report_raid = 38
275+
guild_incident_report_false_alarm = 39
276+
purchase_notification = 44
277+
poll_result = 46
270278

271279

272280
class VoiceRegion(Enum):
@@ -1065,6 +1073,12 @@ class VoiceChannelEffectAnimationType(Enum):
10651073
premium = 0
10661074
basic = 1
10671075

1076+
class MessageReferenceType(Enum):
1077+
"""The type of the message reference object"""
1078+
1079+
default = 0
1080+
forward = 1
1081+
10681082

10691083
class SubscriptionStatus(Enum):
10701084
"""The status of a subscription."""

discord/ext/commands/context.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,3 +403,9 @@ async def send_help(self, *args: Any) -> Any:
403403
@discord.utils.copy_doc(Message.reply)
404404
async def reply(self, content: str | None = None, **kwargs: Any) -> Message:
405405
return await self.message.reply(content, **kwargs)
406+
407+
@discord.utils.copy_doc(Message.forward_to)
408+
async def forward_to(
409+
self, channel: discord.abc.Messageable, **kwargs: Any
410+
) -> Message:
411+
return await self.message.forward_to(channel, **kwargs)

discord/flags.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,14 @@ def is_voice_message(self):
411411
"""
412412
return 8192
413413

414+
@flag_value
415+
def has_snapshot(self):
416+
""":class:`bool`: Returns ``True`` if this message has a snapshot from message forwarding.
417+
418+
.. versionadded:: 2.7
419+
"""
420+
return 1 << 14
421+
414422

415423
@fill_with_flags()
416424
class PublicUserFlags(BaseFlags):

0 commit comments

Comments
 (0)