Pyrogram: Add message_thread_id parameter to forward_message() method and forward() bound method

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2022-12-02 23:30:06 +07:00
parent 9b92492553
commit f22cc34c9a
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
2 changed files with 13 additions and 1 deletions

View file

@ -30,6 +30,7 @@ class ForwardMessages:
chat_id: Union[int, str],
from_chat_id: Union[int, str],
message_ids: Union[int, Iterable[int]],
message_thread_id: int = None,
disable_notification: bool = None,
schedule_date: datetime = None,
protect_content: bool = None
@ -52,6 +53,10 @@ class ForwardMessages:
message_ids (``int`` | Iterable of ``int``):
An iterable of message identifiers in the chat specified in *from_chat_id* or a single message id.
message_thread_id (``int``, *optional*):
Unique identifier of a message thread to which the message belongs.
for supergroups only
disable_notification (``bool``, *optional*):
Sends the message silently.
Users will receive a notification with no sound.
@ -84,6 +89,7 @@ class ForwardMessages:
to_peer=await self.resolve_peer(chat_id),
from_peer=await self.resolve_peer(from_chat_id),
id=message_ids,
top_msg_id=message_thread_id,
silent=disable_notification or None,
random_id=[self.rnd_id() for _ in message_ids],
schedule_date=utils.datetime_to_timestamp(schedule_date),

View file

@ -64,7 +64,8 @@ class Message(Object, Update):
Unique message identifier inside this chat.
message_thread_id (``int``, *optional*):
Unique identifier of a message thread to which the message belongs; for supergroups only
Unique identifier of a message thread to which the message belongs.
for supergroups only
from_user (:obj:`~pyrogram.types.User`, *optional*):
Sender, empty for messages sent to channels.
@ -2994,6 +2995,7 @@ class Message(Object, Update):
async def forward(
self,
chat_id: Union[int, str],
message_thread_id: int = None,
disable_notification: bool = None,
schedule_date: datetime = None
) -> Union["types.Message", List["types.Message"]]:
@ -3020,6 +3022,9 @@ class Message(Object, Update):
For your personal cloud (Saved Messages) you can simply use "me" or "self".
For a contact that exists in your Telegram address book you can use his phone number (str).
message_thread_id (``int``, *optional*):
Unique identifier of a message thread to which the message belongs; for supergroups only
disable_notification (``bool``, *optional*):
Sends the message silently.
Users will receive a notification with no sound.
@ -3037,6 +3042,7 @@ class Message(Object, Update):
chat_id=chat_id,
from_chat_id=self.chat.id,
message_ids=self.id,
message_thread_id=message_thread_id,
disable_notification=disable_notification,
schedule_date=schedule_date
)