Remove unknown attributes and some formatting

This commit is contained in:
Lonami Exo 2018-02-27 11:24:47 +01:00
parent f27d8e508a
commit 5d861afb1d

View File

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