Skip to content

Commit acd29ef

Browse files
authored
adjustments
1 parent 1d6b0bf commit acd29ef

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

discord/channel.py

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

34133413
return PartialMessage(channel=self, id=message_id)
34143414

3415+
def __repr__(self) -> str:
3416+
return f"<PartialMessageable id={self.id} type={self.type!r}>"
3417+
34153418

34163419
def _guild_channel_factory(channel_type: int):
34173420
value = try_enum(ChannelType, channel_type)

discord/message.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -668,20 +668,26 @@ class ForwardedMessage:
668668
Attributes
669669
----------
670670
type: :class:`MessageType`
671-
The type of message. In most cases this should not be checked, but it is helpful
671+
The type of the original message. In most cases this should not be checked, but it is helpful
672672
in cases where it might be a system message for :attr:`system_content`.
673+
original_message: Optional[Union[:class:`Message`, :class:`PartialMessage`]]
674+
The original message that was forwarded, if available.
675+
channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`, :class:`GroupChannel`, :class:`PartialMessageable`]
676+
The :class:`TextChannel` or :class:`Thread` that the original message was sent from.
677+
guild: Optional[Union[:class:`Guild`, :class:`Object`]]
678+
The guild that the original message belonged to, if applicable.
673679
content: :class:`str`
674680
The contents of the original message.
675681
embeds: List[:class:`Embed`]
676682
A list of embeds the original message had.
677683
attachments: List[:class:`Attachment`]
678684
A list of attachments given to the original message.
679685
flags: :class:`MessageFlags`
680-
Extra features of the message.
686+
Extra features of the original message.
681687
mentions: List[Union[:class:`abc.User`, :class:`Object`]]
682-
A list of :class:`Member` that were mentioned.
688+
A list of :class:`Member` that were originally mentioned.
683689
role_mentions: List[Union[:class:`Role`, :class:`Object`]]
684-
A list of :class:`Role` that were mentioned.
690+
A list of :class:`Role` that were originally mentioned.
685691
stickers: List[:class:`StickerItem`]
686692
A list of sticker items given to the original message.
687693
components: List[:class:`Component`]
@@ -699,8 +705,9 @@ def __init__(
699705
self._reference = reference
700706
self.id: int = reference.message_id
701707
self.channel = state.get_channel(reference.channel_id) or (
702-
reference.channel_id and Object(reference.channel_id)
708+
reference.channel_id and PartialMessageable(state=state, id=reference.channel_id, )
703709
)
710+
self.original_message = state.get_message(self.id) or (self.id and channel.get_partial_message(self.id))
704711
self.guild = state._get_guild(reference.guild_id) or (
705712
reference.guild_id and Object(reference.guild_id)
706713
)
@@ -759,6 +766,9 @@ def __init__(
759766
if fm := data.get("message"):
760767
self.message = ForwardedMessage(state=state, reference=reference, data=fm)
761768

769+
def __repr__(self) -> str:
770+
return f"<MessageSnapshot message={self.message!r}>"
771+
762772

763773
def flatten_handlers(cls):
764774
prefix = len("_handle_")
@@ -2076,7 +2086,7 @@ async def reply(self, content: str | None = None, **kwargs) -> Message:
20762086

20772087
return await self.channel.send(content, reference=self.to_reference(), **kwargs)
20782088

2079-
async def forward(
2089+
async def forward_to(
20802090
self, channel: MessageableChannel | PartialMessageableChannel, **kwargs
20812091
) -> Message:
20822092
"""|coro|
@@ -2108,7 +2118,7 @@ async def forward(
21082118
"""
21092119

21102120
return await channel.send(
2111-
reference=self.to_reference(type=MessageReferenceType.forward)
2121+
reference=self.to_reference(type=MessageReferenceType.forward), **kwargs
21122122
)
21132123

21142124
async def end_poll(self) -> Message:

0 commit comments

Comments
 (0)