Skip to content

Fix method signatures and expand test_official #2643

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

Merged
merged 17 commits into from
Aug 29, 2021
Merged
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
25 changes: 13 additions & 12 deletions telegram/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ def send_venue(
:obj:`title` and :obj:`address` and optionally :obj:`foursquare_id` and
:obj:`foursquare_type` or optionally :obj:`google_place_id` and
:obj:`google_place_type`.
* Foursquare details and Google Pace details are mutually exclusive. However, this
* Foursquare details and Google Place details are mutually exclusive. However, this
behaviour is undocumented and might be changed by Telegram.

Args:
Expand Down Expand Up @@ -2657,10 +2657,10 @@ def edit_message_caption(
@log
def edit_message_media(
self,
media: 'InputMedia',
chat_id: Union[str, int] = None,
message_id: int = None,
inline_message_id: int = None,
media: 'InputMedia' = None,
reply_markup: InlineKeyboardMarkup = None,
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
Expand All @@ -2673,15 +2673,15 @@ def edit_message_media(
``file_id`` or specify a URL.

Args:
media (:class:`telegram.InputMedia`): An object for a new media content
of the message.
chat_id (:obj:`int` | :obj:`str`, optional): Required if inline_message_id is not
specified. Unique identifier for the target chat or username of the target channel
(in the format ``@channelusername``).
message_id (:obj:`int`, optional): Required if inline_message_id is not specified.
Identifier of the message to edit.
inline_message_id (:obj:`str`, optional): Required if chat_id and message_id are not
specified. Identifier of the inline message.
media (:class:`telegram.InputMedia`): An object for a new media content
of the message.
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): A JSON-serialized
object for an inline keyboard.
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
Expand All @@ -2691,7 +2691,7 @@ def edit_message_media(
Telegram API.

Returns:
:class:`telegram.Message`: On success, if edited message is sent by the bot, the
:class:`telegram.Message`: On success, if edited message is not an inline message, the
edited Message is returned, otherwise :obj:`True` is returned.

Raises:
Expand Down Expand Up @@ -2868,7 +2868,7 @@ def get_updates(
@log
def set_webhook(
self,
url: str = None,
url: str,
certificate: FileInput = None,
timeout: ODVInput[float] = DEFAULT_NONE,
max_connections: int = 40,
Expand Down Expand Up @@ -2939,10 +2939,8 @@ def set_webhook(
.. _`guide to Webhooks`: https://core.telegram.org/bots/webhooks

"""
data: JSONDict = {}
data: JSONDict = {'url': url}

if url is not None:
data['url'] = url
if certificate:
data['certificate'] = parse_file_input(certificate)
if max_connections is not None:
Expand Down Expand Up @@ -4231,7 +4229,7 @@ def set_chat_title(
def set_chat_description(
self,
chat_id: Union[str, int],
description: str,
description: str = None,
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
) -> bool:
Expand All @@ -4243,7 +4241,7 @@ def set_chat_description(
Args:
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username
of the target channel (in the format ``@channelusername``).
description (:obj:`str`): New chat description, 0-255 characters.
description (:obj:`str`, optional): New chat description, 0-255 characters.
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
the read timeout from the server (instead of the one specified during creation of
the connection pool).
Expand All @@ -4257,7 +4255,10 @@ def set_chat_description(
:class:`telegram.error.TelegramError`

"""
data: JSONDict = {'chat_id': chat_id, 'description': description}
data: JSONDict = {'chat_id': chat_id}

if description is not None:
data['description'] = description

result = self._post('setChatDescription', data, timeout=timeout, api_kwargs=api_kwargs)

Expand Down
4 changes: 2 additions & 2 deletions telegram/callbackquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def edit_message_reply_markup(

def edit_message_media(
self,
media: 'InputMedia' = None,
media: 'InputMedia',
reply_markup: 'InlineKeyboardMarkup' = None,
timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: JSONDict = None,
Expand All @@ -337,7 +337,7 @@ def edit_message_media(
:meth:`telegram.Bot.edit_message_media` and :meth:`telegram.Message.edit_media`.

Returns:
:class:`telegram.Message`: On success, if edited message is sent by the bot, the
:class:`telegram.Message`: On success, if edited message is not an inline message, the
edited Message is returned, otherwise :obj:`True` is returned.

"""
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy