Rename show_above_text parameter to show_caption_above_media

This commit is contained in:
KurimuzonAkuma 2024-10-24 14:32:19 +03:00
parent e6e7c050c8
commit b5c83aa6fe
9 changed files with 49 additions and 61 deletions

View File

@ -41,7 +41,7 @@ class CopyMediaGroup:
quote_entities: List["types.MessageEntity"] = None,
quote_offset: int = None,
schedule_date: datetime = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
) -> List["types.Message"]:
"""Copy a media group by providing one of the message ids.
@ -103,9 +103,8 @@ class CopyMediaGroup:
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
Returns:
List of :obj:`~pyrogram.types.Message`: On success, a list of copied messages is returned.
@ -178,7 +177,7 @@ class CopyMediaGroup:
quote_offset=quote_offset,
),
schedule_date=utils.datetime_to_timestamp(schedule_date),
invert_media=show_above_text
invert_media=show_caption_above_media
),
sleep_threshold=60
)

View File

@ -35,7 +35,7 @@ class EditMessageMedia:
chat_id: Union[int, str],
message_id: int,
media: "types.InputMedia",
show_above_text: bool = None,
show_caption_above_media: bool = None,
schedule_date: datetime = None,
reply_markup: "types.InlineKeyboardMarkup" = None,
file_name: str = None
@ -59,9 +59,8 @@ class EditMessageMedia:
media (:obj:`~pyrogram.types.InputMedia`):
One of the InputMedia objects describing an animation, audio, document, photo or video.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
@ -282,7 +281,7 @@ class EditMessageMedia:
raw.functions.messages.EditMessage(
peer=await self.resolve_peer(chat_id),
id=message_id,
invert_media=show_above_text,
invert_media=show_caption_above_media,
media=media,
schedule_date=utils.datetime_to_timestamp(schedule_date),
reply_markup=await reply_markup.write(self) if reply_markup else None,

View File

@ -34,7 +34,7 @@ class EditMessageText:
parse_mode: Optional["enums.ParseMode"] = None,
entities: List["types.MessageEntity"] = None,
disable_web_page_preview: bool = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
schedule_date: datetime = None,
reply_markup: "types.InlineKeyboardMarkup" = None
) -> "types.Message":
@ -64,9 +64,8 @@ class EditMessageText:
disable_web_page_preview (``bool``, *optional*):
Disables link previews for links in this message.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
schedule_date (:py:obj:`~datetime.datetime`, *optional*):
Date when the message will be automatically sent.
@ -94,7 +93,7 @@ class EditMessageText:
peer=await self.resolve_peer(chat_id),
id=message_id,
no_webpage=disable_web_page_preview or None,
invert_media=show_above_text or None,
invert_media=show_caption_above_media or None,
schedule_date=utils.datetime_to_timestamp(schedule_date),
reply_markup=await reply_markup.write(self) if reply_markup else None,
**await utils.parse_text_entities(self, text, parse_mode, entities)

View File

@ -43,7 +43,7 @@ class SendCachedMedia:
schedule_date: datetime = None,
protect_content: bool = None,
has_spoiler: bool = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
business_connection_id: str = None,
reply_markup: Union[
"types.InlineKeyboardMarkup",
@ -112,9 +112,8 @@ class SendCachedMedia:
has_spoiler (``bool``, *optional*):
True, if the message media is covered by a spoiler animation.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
business_connection_id (``str``, *optional*):
Unique identifier of the business connection on behalf of which the message will be sent.
@ -139,7 +138,7 @@ class SendCachedMedia:
peer=peer,
media=utils.get_input_media_from_file_id(file_id, has_spoiler=has_spoiler),
silent=disable_notification or None,
invert_media=show_above_text,
invert_media=show_caption_above_media,
reply_to=utils.get_reply_to(
reply_to_message_id=reply_to_message_id,
message_thread_id=message_thread_id,

View File

@ -55,7 +55,7 @@ class SendMediaGroup:
quote_offset: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
business_connection_id: str = None
) -> List["types.Message"]:
"""Send a group of photos or videos as an album.
@ -111,9 +111,8 @@ class SendMediaGroup:
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
business_connection_id (``str``, *optional*):
Unique identifier of the business connection on behalf of which the message will be sent.
@ -468,7 +467,7 @@ class SendMediaGroup:
),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
invert_media=show_above_text,
invert_media=show_caption_above_media,
effect=effect_id,
),
sleep_threshold=60,

View File

@ -35,7 +35,7 @@ class SendMessage:
disable_notification: bool = None,
message_thread_id: int = None,
effect_id: int = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
reply_to_message_id: int = None,
reply_to_chat_id: Union[int, str] = None,
reply_to_story_id: int = None,
@ -87,9 +87,8 @@ class SendMessage:
Unique identifier of the message effect.
For private chats only.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
@ -170,7 +169,7 @@ class SendMessage:
peer=peer,
no_webpage=disable_web_page_preview or None,
silent=disable_notification or None,
invert_media=show_above_text or None,
invert_media=show_caption_above_media or None,
reply_to=utils.get_reply_to(
reply_to_message_id=reply_to_message_id,
message_thread_id=message_thread_id,

View File

@ -52,7 +52,7 @@ class SendPaidMedia:
quote_offset: int = None,
schedule_date: datetime = None,
protect_content: bool = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
business_connection_id: str = None
) -> List["types.Message"]:
"""Send a group or one paid photo/video.
@ -107,9 +107,8 @@ class SendPaidMedia:
protect_content (``bool``, *optional*):
Protects the contents of the sent message from forwarding and saving.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
business_connection_id (``str``, *optional*):
Unique identifier of the business connection on behalf of which the message will be sent.
@ -269,7 +268,7 @@ class SendPaidMedia:
random_id=self.rnd_id(),
schedule_date=utils.datetime_to_timestamp(schedule_date),
noforwards=protect_content,
invert_media=show_above_text,
invert_media=show_caption_above_media,
**await utils.parse_text_entities(self, caption, parse_mode, caption_entities)
),
sleep_threshold=60,

View File

@ -37,7 +37,7 @@ class SendWebPage:
disable_notification: bool = None,
message_thread_id: int = None,
effect_id: int = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
reply_to_message_id: int = None,
reply_to_chat_id: Union[int, str] = None,
reply_to_story_id: int = None,
@ -86,9 +86,8 @@ class SendWebPage:
If True, media in the link preview will be smaller.
Ignored if the URL isn't explicitly specified or media size change isn't supported for the preview.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
disable_notification (``bool``, *optional*):
Sends the message silently.
@ -186,7 +185,7 @@ class SendWebPage:
force_large_media=prefer_large_media,
force_small_media=prefer_small_media
),
invert_media=show_above_text,
invert_media=show_caption_above_media,
entities=entities,
noforwards=protect_content,
effect=effect_id

View File

@ -146,9 +146,8 @@ class Message(Object, Update):
paid_media (:obj:`~pyrogram.types.PaidMediaInfo`, *optional*):
The message is a paid media message.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
If True, caption must be shown above the message media.
edit_date (:py:obj:`~datetime.datetime`, *optional*):
Date the message was last edited.
@ -447,7 +446,7 @@ class Message(Object, Update):
from_scheduled: bool = None,
media: "enums.MessageMediaType" = None,
paid_media: "types.PaidMediaInfo" = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
edit_date: datetime = None,
edit_hidden: bool = None,
media_group_id: int = None,
@ -559,7 +558,7 @@ class Message(Object, Update):
self.from_scheduled = from_scheduled
self.media = media
self.paid_media = paid_media
self.show_above_text = show_above_text
self.show_caption_above_media = show_caption_above_media
self.edit_date = edit_date
self.edit_hidden = edit_hidden
self.media_group_id = media_group_id
@ -1133,7 +1132,7 @@ class Message(Object, Update):
from_scheduled=message.from_scheduled,
media=media_type,
paid_media=paid_media,
show_above_text=getattr(message, "invert_media", None),
show_caption_above_media=getattr(message, "invert_media", None),
edit_date=utils.timestamp_to_datetime(message.edit_date),
edit_hidden=message.edit_hide,
media_group_id=message.grouped_id,
@ -1305,7 +1304,7 @@ class Message(Object, Update):
disable_notification: bool = None,
message_thread_id: int = None,
effect_id: int = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
reply_to_message_id: int = None,
quote_text: str = None,
quote_entities: List["types.MessageEntity"] = None,
@ -1364,9 +1363,8 @@ class Message(Object, Update):
Unique identifier of the message effect.
For private chats only.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
reply_to_message_id (``int``, *optional*):
If the message is a reply, ID of the original message.
@ -1417,7 +1415,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
effect_id=effect_id,
show_above_text=show_above_text,
show_caption_above_media=show_caption_above_media,
reply_to_message_id=reply_to_message_id,
quote_text=quote_text,
quote_entities=quote_entities,
@ -3814,7 +3812,7 @@ class Message(Object, Update):
disable_notification: bool = None,
message_thread_id: int = None,
effect_id: int = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
reply_to_message_id: int = None,
reply_to_chat_id: Union[int, str] = None,
reply_to_story_id: int = None,
@ -3870,9 +3868,8 @@ class Message(Object, Update):
If True, media in the link preview will be smaller.
Ignored if the URL isn't explicitly specified or media size change isn't supported for the preview.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
disable_notification (``bool``, *optional*):
Sends the message silently.
@ -3943,7 +3940,7 @@ class Message(Object, Update):
disable_notification=disable_notification,
message_thread_id=message_thread_id,
effect_id=effect_id,
show_above_text=show_above_text,
show_caption_above_media=show_caption_above_media,
reply_to_message_id=reply_to_message_id,
reply_to_chat_id=reply_to_chat_id,
reply_to_story_id=reply_to_story_id,
@ -3962,7 +3959,7 @@ class Message(Object, Update):
parse_mode: Optional["enums.ParseMode"] = None,
entities: List["types.MessageEntity"] = None,
disable_web_page_preview: bool = None,
show_above_text: bool = None,
show_caption_above_media: bool = None,
reply_markup: "types.InlineKeyboardMarkup" = None
) -> "Message":
"""Bound method *edit_text* of :obj:`~pyrogram.types.Message`.
@ -3998,9 +3995,8 @@ class Message(Object, Update):
disable_web_page_preview (``bool``, *optional*):
Disables link previews for links in this message.
show_above_text (``bool``, *optional*):
If True, link preview will be shown above the message text.
Otherwise, the link preview will be shown below the message text.
show_caption_above_media (``bool``, *optional*):
Pass True, if the caption must be shown above the message media.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*):
An InlineKeyboardMarkup object.
@ -4018,7 +4014,7 @@ class Message(Object, Update):
parse_mode=parse_mode,
entities=entities,
disable_web_page_preview=disable_web_page_preview,
show_above_text=show_above_text,
show_caption_above_media=show_caption_above_media,
reply_markup=reply_markup
)