diff --git a/telethon/telegram_client.py b/telethon/telegram_client.py index 25f42ab9..b6bcd9dd 100644 --- a/telethon/telegram_client.py +++ b/telethon/telegram_client.py @@ -56,8 +56,9 @@ from .tl.functions.messages import ( GetDialogsRequest, GetHistoryRequest, SendMediaRequest, SendMessageRequest, GetChatsRequest, GetAllDraftsRequest, CheckChatInviteRequest, ReadMentionsRequest, SendMultiMediaRequest, - UploadMediaRequest, EditMessageRequest, - GetInlineBotResultsRequest, SendInlineBotResultRequest) + UploadMediaRequest, EditMessageRequest, GetInlineBotResultsRequest, + SendInlineBotResultRequest +) from .tl.functions import channels from .tl.functions import messages @@ -81,7 +82,8 @@ from .tl.types import ( InputDocument, InputMediaDocument, Document, MessageEntityTextUrl, InputMessageEntityMentionName, DocumentAttributeVideo, UpdateEditMessage, UpdateEditChannelMessage, UpdateShort, Updates, - BotInlineResult, InputGeoPointEmpty) + BotInlineResult, InputGeoPointEmpty +) from .tl.types.messages import DialogsSlice from .extensions import markdown, html @@ -911,10 +913,11 @@ class TelegramClient(TelegramBareClient): This is the same as writing @ in a normal Telegram client. - Hint: Once you have received the ``BotResult`` object from this method, - extract the correct answer from - ``get_inline_results( ... ).results`` - and ``client.send_inline_result`` to actually send it. + Hint: + Once you have received the ``BotResult`` object + from this method, extract the correct answer from + ``get_inline_results(...).results`` and + ``client.send_inline_result(...)`` to actually send it. Args: bot (:obj:`entity`): @@ -924,15 +927,14 @@ class TelegramClient(TelegramBareClient): The query text to send. offset (:obj:`str`): - Bots can only send 50 results per inline request. By setting an - ``offset``, bots will know to send the next batch. + Bots can only send 50 results per inline request. By setting + an ``offset``, bots will know to send the next batch. geo_point (:obj:`InputGeoPoint`): - Unknown. # TODO - + Additional geo point information the bot might need. Returns: - An instance of ``BotResults`` + An instance of ``BotResults``. """ if offset is None: offset = '' @@ -943,7 +945,7 @@ class TelegramClient(TelegramBareClient): request = self(GetInlineBotResultsRequest( bot=self.get_input_entity(bot), - peer=InputPeerEmpty(), # "Noone knows what this does" - @haskell + peer=InputPeerEmpty(), # Not sure what this does query=query, offset=offset, geo_point=geo_point or InputGeoPointEmpty() @@ -951,28 +953,23 @@ class TelegramClient(TelegramBareClient): return request def send_inline_result(self, peer, query_id, result, silent=None, - background=None, clear_draft=None, - reply_to_msg_id=None, random_id=None): + clear_draft=None, reply_to_msg_id=None): """ Sends an inline query result obtained by ``client.get_inline_result``. - Args: peer (:obj:`entity`): The bot to send the result to. query_id (:obj:`str`): - The original query's id + The original query's id. result (:obj:`datetime`): One of the choices in the results obtained by ``client.get_inline_result( ... ).results`` silent (:obj:`bool`): - Whether to disable notifications for this message - - background (:obj:`bool`): - Unknown. + Whether to disable notifications for this message. clear_draft (:obj:`bool`): Whether to delete the current draft of the ``peer`` chat @@ -980,11 +977,6 @@ class TelegramClient(TelegramBareClient): reply_to_msg_id (:obj:`int`): The message in the ``peer`` chat to reply to. - random_id (:obj:`int`): - Unknown. # TODO: perhaps the client should in fact send a - random string? - - Returns: The sent message. """ @@ -995,16 +987,15 @@ class TelegramClient(TelegramBareClient): else: raise ValueError("Parameter `result` must be the inline query " "result id or a BotInlineResult object.") + peer = self.get_input_entity(peer) request = SendInlineBotResultRequest( peer=peer, query_id=query_id, id=result_id, silent=silent, - background=background, clear_draft=clear_draft, - reply_to_msg_id=reply_to_msg_id, - random_id=random_id + reply_to_msg_id=reply_to_msg_id ) result = self(request)