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

View File

@@ -435,6 +435,9 @@ where you want to send it to:
Sending messages through inline bots lets you use buttons as a normal user.
It can look a bit strange at first, but you can make inline queries in no
chat in particular, and then click a *result* to send it to some chat.
Clicking Buttons
****************
@@ -449,6 +452,28 @@ This will click the first button in the message. You could also
``click(row, column)``, using some text such as ``click(text='👍')``
or even the data directly ``click(data=b'payload')``.
Answering Inline Queries
************************
As a bot, you can answer to inline queries with `events.InlineQuery
<telethon.events.inlinequery.InlineQuery>`. You should make use of the
`builder <telethon.tl.custom.inlinebuilder.InlineBuilder>` property
to conveniently build the list of results to show to the user. Remember
to check the properties of the `InlineQuery.Event
<telethon.events.inlinequery.InlineQuery.Event>`:
.. code-block:: python
@bot.on(events.InlineQuery)
async def handler(event):
builder = event.builder
rev_text = event.text[::-1]
await event.answer([
builder.article('Reverse text', text=rev_text),
builder.photo('/path/to/photo.jpg')
])
Conversations: Waiting for Messages or Replies
**********************************************

View File

@@ -10,8 +10,6 @@ telethon\.tl\.custom\.draft module
:undoc-members:
:show-inheritance:
telethon\.tl\.custom\.dialog module
-----------------------------------
@@ -20,7 +18,6 @@ telethon\.tl\.custom\.dialog module
:undoc-members:
:show-inheritance:
telethon\.tl\.custom\.message module
------------------------------------
@@ -29,7 +26,6 @@ telethon\.tl\.custom\.message module
:undoc-members:
:show-inheritance:
telethon\.tl\.custom\.messagebutton module
------------------------------------------
@@ -54,6 +50,14 @@ telethon\.tl\.custom\.button module
:undoc-members:
:show-inheritance:
telethon\.tl\.custom\.inlinebuilder module
------------------------------------------
.. automodule:: telethon.tl.custom.inlinebuilder
:members:
:undoc-members:
:show-inheritance:
telethon\.tl\.custom\.inlineresult module
-----------------------------------------
@@ -62,6 +66,14 @@ telethon\.tl\.custom\.inlineresult module
:undoc-members:
:show-inheritance:
telethon\.tl\.custom\.inlineresults module
------------------------------------------
.. automodule:: telethon.tl.custom.inlineresults
:members:
:undoc-members:
:show-inheritance:
telethon\.tl\.custom\.chatgetter module
---------------------------------------