pyrofork: add invert_media parameter to copy_message,edit_message_caption,edit_message_media,send_{animation,cached_media,media_group,photo,video} methods

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2024-06-01 21:43:02 +07:00
parent a50c72b375
commit b97407edab
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
8 changed files with 44 additions and 4 deletions

View file

@ -42,6 +42,7 @@ class CopyMessage:
reply_to_message_id: int = None, reply_to_message_id: int = None,
schedule_date: datetime = None, schedule_date: datetime = None,
protect_content: bool = None, protect_content: bool = None,
invert_media: bool = False,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -104,6 +105,9 @@ class CopyMessage:
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.
invert_media (``bool``, *optional*):
Inverts the position of the media and caption.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard, Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user. instructions to remove reply keyboard or to force a reply from the user.
@ -131,5 +135,6 @@ class CopyMessage:
reply_to_message_id=reply_to_message_id, reply_to_message_id=reply_to_message_id,
schedule_date=schedule_date, schedule_date=schedule_date,
protect_content=protect_content, protect_content=protect_content,
invert_media=invert_media,
reply_markup=reply_markup reply_markup=reply_markup
) )

View file

@ -31,6 +31,7 @@ class EditMessageCaption:
caption: str, caption: str,
parse_mode: Optional["enums.ParseMode"] = None, parse_mode: Optional["enums.ParseMode"] = None,
caption_entities: List["types.MessageEntity"] = None, caption_entities: List["types.MessageEntity"] = None,
invert_media: bool = False,
reply_markup: "types.InlineKeyboardMarkup" = None reply_markup: "types.InlineKeyboardMarkup" = None
) -> "types.Message": ) -> "types.Message":
"""Edit the caption of media messages. """Edit the caption of media messages.
@ -57,6 +58,9 @@ class EditMessageCaption:
caption_entities (List of :obj:`~pyrogram.types.MessageEntity`): caption_entities (List of :obj:`~pyrogram.types.MessageEntity`):
List of special entities that appear in the caption, which can be specified instead of *parse_mode*. List of special entities that appear in the caption, which can be specified instead of *parse_mode*.
invert_media (``bool``, *optional*):
Inverts the position of the media and caption.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*): reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
An InlineKeyboardMarkup object. An InlineKeyboardMarkup object.
@ -74,5 +78,6 @@ class EditMessageCaption:
text=caption, text=caption,
parse_mode=parse_mode, parse_mode=parse_mode,
entities=caption_entities, entities=caption_entities,
invert_media=invert_media,
reply_markup=reply_markup reply_markup=reply_markup
) )

View file

@ -36,7 +36,8 @@ class EditMessageMedia:
message_id: int, message_id: int,
media: "types.InputMedia", media: "types.InputMedia",
reply_markup: "types.InlineKeyboardMarkup" = None, reply_markup: "types.InlineKeyboardMarkup" = None,
file_name: str = None file_name: str = None,
invert_media: bool = False
) -> "types.Message": ) -> "types.Message":
"""Edit animation, audio, document, photo or video messages. """Edit animation, audio, document, photo or video messages.
@ -65,6 +66,9 @@ class EditMessageMedia:
File name of the media to be sent. Not applicable to photos. File name of the media to be sent. Not applicable to photos.
Defaults to file's path basename. Defaults to file's path basename.
invert_media (``bool``, *optional*):
Inverts the position of the media and caption.
Returns: Returns:
:obj:`~pyrogram.types.Message`: On success, the edited message is returned. :obj:`~pyrogram.types.Message`: On success, the edited message is returned.
@ -276,7 +280,8 @@ class EditMessageMedia:
media=media, media=media,
reply_markup=await reply_markup.write(self) if reply_markup else None, reply_markup=await reply_markup.write(self) if reply_markup else None,
message=message, message=message,
entities=entities entities=entities,
invert_media=invert_media
) )
) )

View file

@ -57,6 +57,7 @@ class SendAnimation:
schedule_date: datetime = None, schedule_date: datetime = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: int = None, message_effect_id: int = None,
invert_media: bool = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -160,6 +161,9 @@ class SendAnimation:
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.
invert_media (``bool``, *optional*):
Inverts the position of the animation and caption.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard, Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user. instructions to remove reply keyboard or to force a reply from the user.
@ -283,6 +287,7 @@ class SendAnimation:
schedule_date=utils.datetime_to_timestamp(schedule_date), schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content, noforwards=protect_content,
effect=message_effect_id, effect=message_effect_id,
invert_media=invert_media,
reply_markup=await reply_markup.write(self) if reply_markup else None, reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities) **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
) )

View file

@ -44,6 +44,7 @@ class SendCachedMedia:
quote_entities: List["types.MessageEntity"] = None, quote_entities: List["types.MessageEntity"] = None,
schedule_date: datetime = None, schedule_date: datetime = None,
protect_content: bool = None, protect_content: bool = None,
invert_media: bool = False,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -116,6 +117,9 @@ class SendCachedMedia:
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.
invert_media (``bool``, *optional*):
Inverts the position of the media and caption.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard, Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user. instructions to remove reply keyboard or to force a reply from the user.
@ -156,6 +160,7 @@ class SendCachedMedia:
random_id=self.rnd_id(), random_id=self.rnd_id(),
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,
reply_markup=await reply_markup.write(self) if reply_markup else None, reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities) **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
) )

View file

@ -57,7 +57,8 @@ class SendMediaGroup:
parse_mode: Optional["enums.ParseMode"] = None, parse_mode: Optional["enums.ParseMode"] = None,
schedule_date: datetime = None, schedule_date: datetime = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: int = None message_effect_id: int = None,
invert_media: bool = None
) -> List["types.Message"]: ) -> List["types.Message"]:
"""Send a group of photos or videos as an album. """Send a group of photos or videos as an album.
@ -118,6 +119,9 @@ class SendMediaGroup:
message_effect_id (``int`` ``64-bit``, *optional*): message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only. Unique identifier of the message effect to be added to the message; for private chats only.
invert_media (``bool``, *optional*):
Inverts the position of the media and caption.
Returns: Returns:
List of :obj:`~pyrogram.types.Message`: On success, a list of the sent messages is returned. List of :obj:`~pyrogram.types.Message`: On success, a list of the sent messages is returned.
@ -470,7 +474,8 @@ class SendMediaGroup:
reply_to=reply_to, reply_to=reply_to,
schedule_date=utils.datetime_to_timestamp(schedule_date), schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content, noforwards=protect_content,
effect=message_effect_id effect=message_effect_id,
invert_media=invert_media
) )
if business_connection_id is not None: if business_connection_id is not None:

View file

@ -52,6 +52,7 @@ class SendPhoto:
protect_content: bool = None, protect_content: bool = None,
message_effect_id: int = None, message_effect_id: int = None,
view_once: bool = None, view_once: bool = None,
invert_media: bool = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -141,6 +142,9 @@ class SendPhoto:
Self-Destruct Timer. Self-Destruct Timer.
If True, the photo will self-destruct after it was viewed. If True, the photo will self-destruct after it was viewed.
invert_media (``bool``, *optional*):
Inverts the position of the photo and caption.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard, Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user. instructions to remove reply keyboard or to force a reply from the user.
@ -237,6 +241,7 @@ class SendPhoto:
schedule_date=utils.datetime_to_timestamp(schedule_date), schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content, noforwards=protect_content,
effect=message_effect_id, effect=message_effect_id,
invert_media=invert_media,
reply_markup=await reply_markup.write(self) if reply_markup else None, reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities) **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
) )

View file

@ -58,6 +58,7 @@ class SendVideo:
schedule_date: datetime = None, schedule_date: datetime = None,
protect_content: bool = None, protect_content: bool = None,
message_effect_id: int = None, message_effect_id: int = None,
invert_media: bool = None,
reply_markup: Union[ reply_markup: Union[
"types.InlineKeyboardMarkup", "types.InlineKeyboardMarkup",
"types.ReplyKeyboardMarkup", "types.ReplyKeyboardMarkup",
@ -166,6 +167,9 @@ class SendVideo:
message_effect_id (``int`` ``64-bit``, *optional*): message_effect_id (``int`` ``64-bit``, *optional*):
Unique identifier of the message effect to be added to the message; for private chats only. Unique identifier of the message effect to be added to the message; for private chats only.
invert_media (``bool``, *optional*):
Inverts the position of the video and caption.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*): reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardMarkup` | :obj:`~pyrogram.types.ReplyKeyboardRemove` | :obj:`~pyrogram.types.ForceReply`, *optional*):
Additional interface options. An object for an inline keyboard, custom reply keyboard, Additional interface options. An object for an inline keyboard, custom reply keyboard,
instructions to remove reply keyboard or to force a reply from the user. instructions to remove reply keyboard or to force a reply from the user.
@ -289,6 +293,7 @@ class SendVideo:
schedule_date=utils.datetime_to_timestamp(schedule_date), schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content, noforwards=protect_content,
effect=message_effect_id, effect=message_effect_id,
invert_media=invert_media,
reply_markup=await reply_markup.write(self) if reply_markup else None, reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities) **await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
) )