MTPyroger/docs/source/resources/BotsInteraction.rst

41 lines
1.4 KiB
ReStructuredText
Raw Normal View History

2018-02-27 15:53:41 +00:00
Bots Interaction
================
Users can interact with other bots via plain text messages as well as inline queries.
Inline Bots
-----------
- If a bot accepts inline queries, you can call it by using
2018-04-12 11:43:16 +00:00
:meth:`get_inline_bot_results() <pyrogram.Client.get_inline_bot_results>` to get the list of its inline results
2018-02-27 17:40:50 +00:00
for a query:
2018-02-27 15:53:41 +00:00
.. code-block:: python
# Get bot results for "Fuzz Universe" from the inline bot @vid
bot_results = app.get_inline_bot_results("vid", "Fuzz Universe")
2018-02-27 15:53:41 +00:00
2018-03-24 13:47:20 +00:00
.. figure:: https://i.imgur.com/IAqLs54.png
2018-02-27 15:53:41 +00:00
:width: 90%
:align: center
:figwidth: 60%
2018-04-12 11:43:16 +00:00
``get_inline_bot_results()`` is the equivalent action of writing ``@vid Fuzz Universe`` and getting the
2018-02-27 15:53:41 +00:00
results list.
- After you retrieved the bot results, you can use
2018-04-12 11:43:16 +00:00
:meth:`send_inline_bot_result() <pyrogram.Client.send_inline_bot_result>` to send a chosen result to any chat:
2018-02-27 15:53:41 +00:00
.. code-block:: python
# Send the first result (bot_results.results[0]) to your own chat (Saved Messages)
app.send_inline_bot_result("me", bot_results.query_id, bot_results.results[0].id)
2018-02-27 15:53:41 +00:00
2018-03-24 13:47:20 +00:00
.. figure:: https://i.imgur.com/wwxr7B7.png
2018-02-27 15:53:41 +00:00
:width: 90%
:align: center
:figwidth: 60%
2018-04-12 11:43:16 +00:00
``send_inline_bot_result()`` is the equivalent action of choosing a result from the list and sending it
2018-02-27 15:53:41 +00:00
to a chat.