Document InlineBuilder

This commit is contained in:
Lonami Exo
2018-10-12 12:38:46 +02:00
parent 9ee415749d
commit 74f7ae525f
5 changed files with 54 additions and 15 deletions
+6 -3
View File
@@ -71,6 +71,9 @@ class InlineQuery(EventBuilder):
query (:tl:`UpdateBotCallbackQuery`):
The original :tl:`UpdateBotCallbackQuery`.
Make sure to access the `text` of the query if
that's what you want instead working with this.
pattern_match (`obj`, optional):
The resulting object from calling the passed ``pattern``
function, which is ``re.compile(...).match`` by default.
@@ -117,8 +120,8 @@ class InlineQuery(EventBuilder):
@property
def builder(self):
"""
Returns a new `inline result builder
<telethon.tl.custom.inline.InlineBuilder>`.
Returns a new `InlineBuilder
<telethon.tl.custom.inlinebuilder.InlineBuilder>` instance.
"""
return custom.InlineBuilder(self._client)
@@ -134,7 +137,7 @@ class InlineQuery(EventBuilder):
A list of :tl:`InputBotInlineResult` to use.
You should use `builder` to create these:
.. code-block: python
.. code-block:: python
builder = inline.builder
r1 = builder.article('Be nice', text='Have a nice day')
+6 -8
View File
@@ -6,7 +6,8 @@ from ... import utils
class InlineBuilder:
"""
Helper class to allow defining inline queries ``results``.
Helper class to allow defining `InlineQuery
<telethon.events.inlinequery.InlineQuery>` ``results``.
Common arguments to all methods are
explained here to avoid repetition:
@@ -19,16 +20,13 @@ class InlineBuilder:
Whether to show a link preview in the sent
text message or not.
geo (:tl:`InputGeoPoint`, :tl:`GeoPoint`,
:tl:`InputMediaVenue`, :tl:`MessageMediaVenue`,
optional):
geo (:tl:`InputGeoPoint`, :tl:`GeoPoint`, :tl:`InputMediaVenue`, :tl:`MessageMediaVenue`, optional):
If present, it may either be a geo point or a venue.
period (int, optional):
The period in seconds to be used for geo points.
contact (:tl:`InputMediaContact`, :tl:`MessageMediaContact`,
optional):
contact (:tl:`InputMediaContact`, :tl:`MessageMediaContact`, optional):
If present, it must be the contact information to send.
game (`bool`, optional):
@@ -155,8 +153,8 @@ class InlineBuilder:
Args:
file (`obj`):
Same as ``file`` for `<client.send_file>
telethon.client.uploads.UploadMethods.send_file`.
Same as ``file`` for `client.send_file
<telethon.client.uploads.UploadMethods.send_file>`.
title (`str`, optional):
The title to be shown for this result.
+1
View File
@@ -2,6 +2,7 @@ import time
from .inlineresult import InlineResult
class InlineResults(list):
"""
Custom class that encapsulates :tl:`BotResults` providing