Pyrofork: Add message_effect_id and allow_paid_broadcast copy_media_group method

This commit is contained in:
Yasir Aris M 2025-01-29 07:34:13 +07:00 committed by Yasir
parent 8f9797f57c
commit 3e504edcc1

View file

@ -34,6 +34,7 @@ class CopyMediaGroup:
has_spoilers: Union[List[bool], bool] = None, has_spoilers: Union[List[bool], bool] = None,
disable_notification: bool = None, disable_notification: bool = None,
message_thread_id: int = None, message_thread_id: int = None,
send_as: Union[int, str] = None,
reply_to_message_id: int = None, reply_to_message_id: int = None,
reply_to_chat_id: Union[int, str] = None, reply_to_chat_id: Union[int, str] = None,
reply_to_story_id: int = None, reply_to_story_id: int = None,
@ -44,6 +45,8 @@ class CopyMediaGroup:
schedule_date: datetime = None, schedule_date: datetime = None,
invert_media: bool = None, invert_media: bool = None,
protect_content: bool = None, protect_content: bool = None,
allow_paid_broadcast: bool = None,
message_effect_id: int = None,
) -> List["types.Message"]: ) -> List["types.Message"]:
"""Copy a media group by providing one of the message ids. """Copy a media group by providing one of the message ids.
@ -73,6 +76,9 @@ class CopyMediaGroup:
If a ``string`` is passed, it becomes a caption only for the first media. If a ``string`` is passed, it becomes a caption only for the first media.
If a list of ``string`` passed, each element becomes caption for each media element. If a list of ``string`` passed, each element becomes caption for each media element.
You can pass ``None`` in list to keep the original caption (see examples below). You can pass ``None`` in list to keep the original caption (see examples below).
has_spoilers (``bool``, *optional*):
Pass True if the photo needs to be covered with a spoiler animation.
disable_notification (``bool``, *optional*): disable_notification (``bool``, *optional*):
Sends the message silently. Sends the message silently.
@ -82,6 +88,10 @@ class CopyMediaGroup:
Unique identifier for the target message thread (topic) of the forum. Unique identifier for the target message thread (topic) of the forum.
For supergroups only. For supergroups only.
send_as (``int`` | ``str``):
Unique identifier (int) or username (str) of the chat or channel to send the message as.
You can use this to send the message on behalf of a chat or channel where you have appropriate permissions.
reply_to_message_id (``int``, *optional*): reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message. If the message is a reply, ID of the original message.
@ -113,6 +123,12 @@ class CopyMediaGroup:
protect_content (``bool``, *optional*): protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving Protects the contents of the sent message from forwarding and saving
allow_paid_broadcast (``bool``, *optional*):
Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only
message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only.
Returns: Returns:
List of :obj:`~pyrogram.types.Message`: On success, a list of copied messages is returned. List of :obj:`~pyrogram.types.Message`: On success, a list of copied messages is returned.
@ -186,9 +202,12 @@ class CopyMediaGroup:
multi_media=multi_media, multi_media=multi_media,
silent=disable_notification or None, silent=disable_notification or None,
reply_to=reply_to, reply_to=reply_to,
send_as=await self.resolve_peer(send_as) if send_as else None,
schedule_date=utils.datetime_to_timestamp(schedule_date), schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content, noforwards=protect_content,
invert_media=invert_media invert_media=invert_media,
allow_paid_floodskip=allow_paid_broadcast,
effect=message_effect_id,
), ),
sleep_threshold=60 sleep_threshold=60
) )
@ -205,4 +224,4 @@ class CopyMediaGroup:
users=r.users, users=r.users,
chats=r.chats chats=r.chats
) )
) )