Skip to content
28 changes: 14 additions & 14 deletions telebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2002,7 +2002,7 @@ def copy_message(
video_start_timestamp: Optional[int]=None,
direct_messages_topic_id: Optional[int]=None,
suggested_post_parameters: Optional[types.SuggestedPostParameters]=None,
message_effect_id: Optional[str]=None) -> types.MessageID:
message_effect_id: Optional[str]=None) -> types.MessageId:
"""
Use this method to copy messages of any kind.
Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
Expand Down Expand Up @@ -2078,7 +2078,7 @@ def copy_message(
:type message_effect_id: :obj:`str`

:return: On success, the MessageId of the sent message is returned.
:rtype: :class:`telebot.types.MessageID`
:rtype: :class:`telebot.types.MessageId`
"""

disable_notification = self.disable_notification if (disable_notification is None) else disable_notification
Expand All @@ -2103,7 +2103,7 @@ def copy_message(
if reply_parameters and (reply_parameters.allow_sending_without_reply is None):
reply_parameters.allow_sending_without_reply = self.allow_sending_without_reply

return types.MessageID.de_json(
return types.MessageId.de_json(
apihelper.copy_message(self.token, chat_id, from_chat_id, message_id, caption=caption,
parse_mode=parse_mode, caption_entities=caption_entities, disable_notification=disable_notification,
reply_markup=reply_markup, timeout=timeout, protect_content=protect_content,
Expand Down Expand Up @@ -2254,7 +2254,7 @@ def delete_all_message_reactions(self, chat_id: Union[int, str], user_id: Option

def forward_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int], message_ids: List[int],
disable_notification: Optional[bool]=None, message_thread_id: Optional[int]=None,
protect_content: Optional[bool]=None, direct_messages_topic_id: Optional[int]=None) -> List[types.MessageID]:
protect_content: Optional[bool]=None, direct_messages_topic_id: Optional[int]=None) -> List[types.MessageId]:
"""
Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded, they are skipped.
Service messages and messages with protected content can't be forwarded. Album grouping is kept for forwarded messages.
Expand Down Expand Up @@ -2285,7 +2285,7 @@ def forward_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, in
:type direct_messages_topic_id: :obj:`int`

:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.MessageID`
:rtype: :class:`telebot.types.MessageId`
"""

disable_notification = self.disable_notification if (disable_notification is None) else disable_notification
Expand All @@ -2295,13 +2295,13 @@ def forward_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, in
self.token, chat_id, from_chat_id, message_ids,
disable_notification=disable_notification, message_thread_id=message_thread_id,
protect_content=protect_content, direct_messages_topic_id=direct_messages_topic_id)
return [types.MessageID.de_json(message_id) for message_id in result]
return [types.MessageId.de_json(message_id) for message_id in result]


def copy_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int], message_ids: List[int],
disable_notification: Optional[bool] = None, message_thread_id: Optional[int] = None,
protect_content: Optional[bool] = None, remove_caption: Optional[bool] = None,
direct_messages_topic_id: Optional[int] = None) -> List[types.MessageID]:
direct_messages_topic_id: Optional[int] = None) -> List[types.MessageId]:
"""
Use this method to copy messages of any kind.
If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages,
Expand Down Expand Up @@ -2338,7 +2338,7 @@ def copy_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int],
:type direct_messages_topic_id: :obj:`int`

:return: On success, an array of MessageId of the sent messages is returned.
:rtype: :obj:`list` of :class:`telebot.types.MessageID`
:rtype: :obj:`list` of :class:`telebot.types.MessageId`
"""
disable_notification = self.disable_notification if disable_notification is None else disable_notification
protect_content = self.protect_content if protect_content is None else protect_content
Expand All @@ -2347,7 +2347,7 @@ def copy_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int],
self.token, chat_id, from_chat_id, message_ids, disable_notification=disable_notification,
message_thread_id=message_thread_id, protect_content=protect_content, remove_caption=remove_caption,
direct_messages_topic_id=direct_messages_topic_id)
return [types.MessageID.de_json(message_id) for message_id in result]
return [types.MessageId.de_json(message_id) for message_id in result]

def send_checklist(
self, business_connection_id: str, chat_id: Union[int, str],
Expand Down Expand Up @@ -7352,7 +7352,7 @@ def answer_callback_query(
self.token, callback_query_id, text=text, show_alert=show_alert, url=url, cache_time=cache_time)


def answer_guest_query(self, guest_query_id: str, result: types.InlineQueryResultBase) -> types.SentGuestMessage:
def answer_guest_query(self, guest_query_id: str, result: types.InlineQueryResult) -> types.SentGuestMessage:
"""
Use this method to reply to a received guest message. On success, a SentGuestMessage object is returned.

Expand Down Expand Up @@ -8862,7 +8862,7 @@ def get_forum_topic_icon_stickers(self) -> List[types.Sticker]:
return apihelper.get_forum_topic_icon_stickers(self.token)


def answer_web_app_query(self, web_app_query_id: str, result: types.InlineQueryResultBase) -> types.SentWebAppMessage:
def answer_web_app_query(self, web_app_query_id: str, result: types.InlineQueryResult) -> types.SentWebAppMessage:
"""
Use this method to set the result of an interaction with a Web App and
send a corresponding message on behalf of the user to the chat from which
Expand All @@ -8875,15 +8875,15 @@ def answer_web_app_query(self, web_app_query_id: str, result: types.InlineQueryR
:type web_app_query_id: :obj:`str`

:param result: A JSON-serialized object describing the message to be sent
:type result: :class:`telebot.types.InlineQueryResultBase`
:type result: :class:`telebot.types.InlineQueryResult`

:return: On success, a SentWebAppMessage object is returned.
:rtype: :class:`telebot.types.SentWebAppMessage`
"""
return apihelper.answer_web_app_query(self.token, web_app_query_id, result)

def save_prepared_inline_message(
self, user_id: int, result: types.InlineQueryResultBase, allow_user_chats: Optional[bool]=None,
self, user_id: int, result: types.InlineQueryResult, allow_user_chats: Optional[bool]=None,
allow_bot_chats: Optional[bool]=None, allow_group_chats: Optional[bool]=None,
allow_channel_chats: Optional[bool]=None) -> types.PreparedInlineMessage:
"""
Expand All @@ -8896,7 +8896,7 @@ def save_prepared_inline_message(
:type user_id: :obj:`int`

:param result: A JSON-serialized object describing the message to be sent
:type result: :class:`telebot.types.InlineQueryResultBase`
:type result: :class:`telebot.types.InlineQueryResult`

:param allow_user_chats: Pass True if the message can be sent to private chats with users
:type allow_user_chats: :obj:`bool`
Expand Down
4 changes: 2 additions & 2 deletions telebot/apihelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2667,13 +2667,13 @@ def delete_sticker_from_set(token, sticker):
return _make_request(token, method_url, params=payload, method='post')


def answer_web_app_query(token, web_app_query_id, result: types.InlineQueryResultBase):
def answer_web_app_query(token, web_app_query_id, result: types.InlineQueryResult):
method_url = 'answerWebAppQuery'
payload = {'web_app_query_id': web_app_query_id, 'result': result.to_json()}
return _make_request(token, method_url, params=payload, method='post')


def save_prepared_inline_message(token, user_id, result: types.InlineQueryResultBase, allow_user_chats=None,
def save_prepared_inline_message(token, user_id, result: types.InlineQueryResult, allow_user_chats=None,
allow_bot_chats=None, allow_group_chats=None, allow_channel_chats=None):
method_url = 'savePreparedInlineMessage'
payload = {'user_id': user_id, 'result': result.to_json()}
Expand Down
28 changes: 14 additions & 14 deletions telebot/async_telebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3365,7 +3365,7 @@ async def delete_chat_sticker_set(self, chat_id: Union[int, str]) -> bool:
result = await asyncio_helper.delete_chat_sticker_set(self.token, chat_id)
return result

async def answer_web_app_query(self, web_app_query_id: str, result: types.InlineQueryResultBase) -> types.SentWebAppMessage:
async def answer_web_app_query(self, web_app_query_id: str, result: types.InlineQueryResult) -> types.SentWebAppMessage:
"""
Use this method to set the result of an interaction with a Web App and
send a corresponding message on behalf of the user to the chat from which
Expand All @@ -3378,15 +3378,15 @@ async def answer_web_app_query(self, web_app_query_id: str, result: types.Inline
:type web_app_query_id: :obj:`str`

:param result: A JSON-serialized object describing the message to be sent
:type result: :class:`telebot.types.InlineQueryResultBase`
:type result: :class:`telebot.types.InlineQueryResult`

:return: On success, a SentWebAppMessage object is returned.
:rtype: :class:`telebot.types.SentWebAppMessage`
"""

return await asyncio_helper.answer_web_app_query(self.token, web_app_query_id, result)

async def save_prepared_inline_message(self, user_id: int, result: types.InlineQueryResultBase, allow_user_chats: Optional[bool]=None,
async def save_prepared_inline_message(self, user_id: int, result: types.InlineQueryResult, allow_user_chats: Optional[bool]=None,
allow_bot_chats: Optional[bool]=None, allow_group_chats: Optional[bool]=None, allow_channel_chats: Optional[bool]=None) -> types.PreparedInlineMessage:
"""
Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
Expand All @@ -3397,7 +3397,7 @@ async def save_prepared_inline_message(self, user_id: int, result: types.InlineQ
:type user_id: :obj:`int`

:param result: A JSON-serialized object describing the message to be sent
:type result: :class:`telebot.types.InlineQueryResultBase`
:type result: :class:`telebot.types.InlineQueryResult`

:param allow_user_chats: Pass True if the message can be sent to private chats with users
:type allow_user_chats: :obj:`bool`, optional
Expand Down Expand Up @@ -3697,7 +3697,7 @@ async def copy_message(
video_start_timestamp: Optional[bool]=None,
direct_messages_topic_id: Optional[int]=None,
suggested_post_parameters: Optional[types.SuggestedPostParameters]=None,
message_effect_id: Optional[str]=None) -> types.MessageID:
message_effect_id: Optional[str]=None) -> types.MessageId:
"""
Use this method to copy messages of any kind.
If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages,
Expand Down Expand Up @@ -3774,7 +3774,7 @@ async def copy_message(
:type message_effect_id: :obj:`str`

:return: On success, the MessageId of the sent message is returned.
:rtype: :class:`telebot.types.MessageID`
:rtype: :class:`telebot.types.MessageId`
"""
parse_mode = self.parse_mode if (parse_mode is None) else parse_mode
disable_notification = self.disable_notification if (disable_notification is None) else disable_notification
Expand All @@ -3800,7 +3800,7 @@ async def copy_message(
if reply_parameters and (reply_parameters.allow_sending_without_reply is None):
reply_parameters.allow_sending_without_reply = self.allow_sending_without_reply

return types.MessageID.de_json(
return types.MessageId.de_json(
await asyncio_helper.copy_message(self.token, chat_id=chat_id, from_chat_id=from_chat_id, message_id=message_id,
caption=caption, parse_mode=parse_mode, caption_entities=caption_entities,
disable_notification=disable_notification, protect_content=protect_content,
Expand Down Expand Up @@ -3950,7 +3950,7 @@ async def delete_all_message_reactions(self, chat_id: Union[int, str], user_id:

async def forward_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int], message_ids: List[int], disable_notification: Optional[bool]=None,
message_thread_id: Optional[int]=None, protect_content: Optional[bool]=None,
direct_messages_topic_id: Optional[int]=None) -> List[types.MessageID]:
direct_messages_topic_id: Optional[int]=None) -> List[types.MessageId]:
"""
Use this method to forward multiple messages of any kind. If some of the specified messages can't be found or forwarded,
they are skipped. Service messages and messages with protected content can't be forwarded.
Expand Down Expand Up @@ -3981,19 +3981,19 @@ async def forward_messages(self, chat_id: Union[str, int], from_chat_id: Union[s
:type direct_messages_topic_id: :obj:`int`

:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.MessageID`
:rtype: :class:`telebot.types.MessageId`
"""

disable_notification = self.disable_notification if (disable_notification is None) else disable_notification
protect_content = self.protect_content if (protect_content is None) else protect_content
result = await asyncio_helper.forward_messages(self.token, chat_id, from_chat_id, message_ids, disable_notification, message_thread_id, protect_content,
direct_messages_topic_id=direct_messages_topic_id)
return [types.MessageID.de_json(message_id) for message_id in result]
return [types.MessageId.de_json(message_id) for message_id in result]

async def copy_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int], message_ids: List[int],
disable_notification: Optional[bool] = None, message_thread_id: Optional[int] = None,
protect_content: Optional[bool] = None, remove_caption: Optional[bool] = None,
direct_messages_topic_id: Optional[int] = None) -> List[types.MessageID]:
direct_messages_topic_id: Optional[int] = None) -> List[types.MessageId]:
"""
Use this method to copy messages of any kind.
Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
Expand Down Expand Up @@ -4028,13 +4028,13 @@ async def copy_messages(self, chat_id: Union[str, int], from_chat_id: Union[str,
:type direct_messages_topic_id: :obj:`int`

:return: On success, an array of MessageId of the sent messages is returned.
:rtype: :obj:`list` of :class:`telebot.types.MessageID`
:rtype: :obj:`list` of :class:`telebot.types.MessageId`
"""
disable_notification = self.disable_notification if disable_notification is None else disable_notification
protect_content = self.protect_content if protect_content is None else protect_content
result = await asyncio_helper.copy_messages(self.token, chat_id, from_chat_id, message_ids, disable_notification, message_thread_id,
protect_content, remove_caption, direct_messages_topic_id)
return [types.MessageID.de_json(message_id) for message_id in result]
return [types.MessageId.de_json(message_id) for message_id in result]

async def send_checklist(
self, business_connection_id: str, chat_id: Union[int, str],
Expand Down Expand Up @@ -8976,7 +8976,7 @@ async def answer_callback_query(
return await asyncio_helper.answer_callback_query(self.token, callback_query_id, text, show_alert, url, cache_time)


async def answer_guest_query(self, guest_query_id: str, result: types.InlineQueryResultBase) -> types.SentGuestMessage:
async def answer_guest_query(self, guest_query_id: str, result: types.InlineQueryResult) -> types.SentGuestMessage:
"""
Use this method to reply to a received guest message. On success, a SentGuestMessage object is returned.

Expand Down
4 changes: 2 additions & 2 deletions telebot/asyncio_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,13 @@ async def delete_chat_sticker_set(token, chat_id):
return await _process_request(token, method_url, params=payload)


async def answer_web_app_query(token, web_app_query_id, result: types.InlineQueryResultBase):
async def answer_web_app_query(token, web_app_query_id, result: types.InlineQueryResult):
method_url = 'answerWebAppQuery'
payload = {'web_app_query_id': web_app_query_id, 'result': result.to_json()}
return await _process_request(token, method_url, params=payload, method='post')


async def save_prepared_inline_message(token, user_id, result: types.InlineQueryResultBase, allow_user_chats=None, allow_bot_chats=None, allow_group_chats=None, allow_channel_chats=None):
async def save_prepared_inline_message(token, user_id, result: types.InlineQueryResult, allow_user_chats=None, allow_bot_chats=None, allow_group_chats=None, allow_channel_chats=None):
method_url = r'savePreparedInlineMessage'
payload = {'user_id': user_id, 'result': result.to_json()}
if allow_user_chats is not None:
Expand Down
Loading
Loading