Skip to content

Remove Deprecated Warnings, in future #165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions pyrogram/methods/bots/send_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ async def send_game(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reply_to_message_id: int = None
) -> "types.Message":
"""Send a game.

Expand Down Expand Up @@ -105,19 +104,6 @@ async def send_game(
await app.send_game(chat_id, "gamename")
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

reply_to = await utils._get_reply_message_parameters(
self,
message_thread_id,
Expand Down
14 changes: 0 additions & 14 deletions pyrogram/methods/bots/send_inline_bot_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ async def send_inline_bot_result(
paid_message_star_count: int = None,
message_thread_id: int = None,
schedule_date: datetime = None,
reply_to_message_id: int = None
) -> Union["types.Message", bool]:
"""Send an inline bot result.
Bot results can be retrieved using :meth:`~pyrogram.Client.get_inline_bot_results`
Expand Down Expand Up @@ -92,19 +91,6 @@ async def send_inline_bot_result(
await app.send_inline_bot_result(chat_id, query_id, result_id)
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

reply_to = await utils._get_reply_message_parameters(
self,
message_thread_id,
Expand Down
14 changes: 0 additions & 14 deletions pyrogram/methods/messages/copy_media_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ async def copy_media_group(
allow_paid_broadcast: bool = None,
paid_message_star_count: int = None,
message_effect_id: int = None,
reply_to_message_id: int = None
) -> list["types.Message"]:
"""Copy a media group by providing one of the message ids.

Expand Down Expand Up @@ -118,19 +117,6 @@ async def copy_media_group(
captions=["caption 1", None, ""])
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

media_group = await self.get_media_group(from_chat_id, message_id)
multi_media = []
show_caption_above_media = []
Expand Down
14 changes: 0 additions & 14 deletions pyrogram/methods/messages/copy_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ async def copy_message(
send_as: Union[int, str] = None,
protect_content: bool = None,
message_thread_id: int = None,
reply_to_message_id: int = None
) -> "types.Message":
"""Copy messages of any kind.

Expand Down Expand Up @@ -142,19 +141,6 @@ async def copy_message(

"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

message: types.Message = await self.get_messages(
chat_id=from_chat_id,
message_ids=message_id
Expand Down
13 changes: 0 additions & 13 deletions pyrogram/methods/messages/edit_inline_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ async def edit_inline_text(
entities: list["types.MessageEntity"] = None,
link_preview_options: "types.LinkPreviewOptions" = None,
reply_markup: "types.InlineKeyboardMarkup" = None,
disable_web_page_preview: bool = None
) -> bool:
"""Edit the text of inline messages.

Expand Down Expand Up @@ -80,18 +79,6 @@ async def edit_inline_text(
)
)
"""
if disable_web_page_preview and link_preview_options:
raise ValueError(
"Parameters `disable_web_page_preview` and `link_preview_options` are mutually "
"exclusive."
)

if disable_web_page_preview is not None:
log.warning(
"This property is deprecated. "
"Please use link_preview_options instead"
)
link_preview_options = types.LinkPreviewOptions(is_disabled=disable_web_page_preview)

link_preview_options = link_preview_options or self.link_preview_options

Expand Down
13 changes: 0 additions & 13 deletions pyrogram/methods/messages/edit_message_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ async def edit_message_text(
reply_markup: "types.InlineKeyboardMarkup" = None,
schedule_date: datetime = None,
business_connection_id: str = None,
disable_web_page_preview: bool = None
) -> "types.Message":
"""Edit the text of messages.

Expand Down Expand Up @@ -94,18 +93,6 @@ async def edit_message_text(
)
)
"""
if disable_web_page_preview and link_preview_options:
raise ValueError(
"Parameters `disable_web_page_preview` and `link_preview_options` are mutually "
"exclusive."
)

if disable_web_page_preview is not None:
log.warning(
"This property is deprecated. "
"Please use link_preview_options instead"
)
link_preview_options = types.LinkPreviewOptions(is_disabled=disable_web_page_preview)

link_preview_options = link_preview_options or self.link_preview_options

Expand Down
14 changes: 0 additions & 14 deletions pyrogram/methods/messages/send_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ async def send_animation(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reply_to_message_id: int = None,
progress: Callable = None,
progress_args: tuple = ()
) -> Optional["types.Message"]:
Expand Down Expand Up @@ -217,19 +216,6 @@ async def progress(current, total):
await app.send_animation("me", "animation.gif", ttl_seconds=10)
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

file = None

try:
Expand Down
14 changes: 0 additions & 14 deletions pyrogram/methods/messages/send_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ async def send_audio(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reply_to_message_id: int = None,
progress: Callable = None,
progress_args: tuple = ()
) -> Optional["types.Message"]:
Expand Down Expand Up @@ -199,19 +198,6 @@ async def progress(current, total):
await app.send_audio("me", "audio.mp3", progress=progress)
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

file = None

try:
Expand Down
14 changes: 0 additions & 14 deletions pyrogram/methods/messages/send_cached_media.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ async def send_cached_media(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reply_to_message_id: int = None
) -> Optional["types.Message"]:
"""Send any media stored on the Telegram servers using a file_id.

Expand Down Expand Up @@ -136,19 +135,6 @@ async def send_cached_media(
await app.send_cached_media("me", file_id)
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

reply_to = await utils._get_reply_message_parameters(
self,
message_thread_id,
Expand Down
14 changes: 0 additions & 14 deletions pyrogram/methods/messages/send_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ async def send_contact(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reply_to_message_id: int = None
) -> "types.Message":
"""Send phone contacts.

Expand Down Expand Up @@ -122,19 +121,6 @@ async def send_contact(
await app.send_contact("me", "+1-123-456-7890", "Name")
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

reply_to = await utils._get_reply_message_parameters(
self,
message_thread_id,
Expand Down
14 changes: 0 additions & 14 deletions pyrogram/methods/messages/send_dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ async def send_dice(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reply_to_message_id: int = None
) -> Optional["types.Message"]:
"""Send a dice with a random value from 1 to 6.

Expand Down Expand Up @@ -121,19 +120,6 @@ async def send_dice(
await app.send_dice(chat_id, "🏀")
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

reply_to = await utils._get_reply_message_parameters(
self,
message_thread_id,
Expand Down
28 changes: 0 additions & 28 deletions pyrogram/methods/messages/send_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ async def send_document(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reply_to_message_id: int = None,
force_document: bool = None,
progress: Callable = None,
progress_args: tuple = ()
) -> Optional["types.Message"]:
Expand Down Expand Up @@ -188,32 +186,6 @@ async def progress(current, total):
await app.send_document("me", "document.zip", progress=progress)
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

if force_document and disable_content_type_detection:
raise ValueError(
"Parameters `force_document` and `disable_content_type_detection` "
"are mutually exclusive."
)

if force_document is not None:
log.warning(
"This property is deprecated. "
"Please use disable_content_type_detection instead"
)
disable_content_type_detection = force_document

file = None

try:
Expand Down
14 changes: 0 additions & 14 deletions pyrogram/methods/messages/send_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ async def send_location(
"types.ReplyKeyboardRemove",
"types.ForceReply"
] = None,
reply_to_message_id: int = None
) -> "types.Message":
"""Send points on the map.

Expand Down Expand Up @@ -120,19 +119,6 @@ async def send_location(
app.send_location("me", latitude, longitude)
"""

if reply_to_message_id and reply_parameters:
raise ValueError(
"Parameters `reply_to_message_id` and `reply_parameters` are mutually "
"exclusive."
)

if reply_to_message_id is not None:
log.warning(
"This property is deprecated. "
"Please use reply_parameters instead"
)
reply_parameters = types.ReplyParameters(message_id=reply_to_message_id)

reply_to = await utils._get_reply_message_parameters(
self,
message_thread_id,
Expand Down
Loading