mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 20:59:29 +00:00
538f1e3972
- Pyrogram core is now fully asynchronous - Ditched Python 3.5, welcome 3.6 as minimum version. - Moved all types to pyrogram.types - Turned the Filters class into a module (filters) - Moved all filters to pyrogram.filters - Moved all handlers to pyrogram.handlers - Moved all emoji to pyrogram.emoji - Renamed pyrogram.api to pyrogram.raw - Clock is now synced with server's time - Telegram schema updated to Layer 117 - Greatly improved the TL compiler (proper type-constructor hierarchy) - Added "do not edit" warning in generated files - Crypto parts are executed in a thread pool to avoid blocking the event loop - idle() is now a separate function (it doesn't deal with Client instances) - Async storage, async filters and async progress callback (optional, can be sync too) - Added getpass back, for hidden password inputs
51 lines
1.4 KiB
ReStructuredText
51 lines
1.4 KiB
ReStructuredText
Bots Interaction
|
|
================
|
|
|
|
Users can interact with other bots via plain text messages as well as inline queries.
|
|
|
|
.. contents:: Contents
|
|
:backlinks: none
|
|
:depth: 1
|
|
:local:
|
|
|
|
-----
|
|
|
|
Inline Bots
|
|
-----------
|
|
|
|
- If a bot accepts inline queries, you can call it by using
|
|
:meth:`~pyrogram.Client.get_inline_bot_results` to get the list of its inline results for a query:
|
|
|
|
.. code-block:: python
|
|
|
|
# Get bot results for "Fuzz Universe" from the inline bot @vid
|
|
bot_results = app.get_inline_bot_results("vid", "Fuzz Universe")
|
|
|
|
.. figure:: https://i.imgur.com/IAqLs54.png
|
|
:width: 90%
|
|
:align: center
|
|
:figwidth: 60%
|
|
|
|
``get_inline_bot_results()`` is the equivalent action of writing ``@vid Fuzz Universe`` and getting the
|
|
results list.
|
|
|
|
- After you retrieved the bot results, you can use
|
|
:meth:`~pyrogram.Client.send_inline_bot_result` to send a chosen result to any chat:
|
|
|
|
.. code-block:: python
|
|
|
|
# Send the first result to your own chat
|
|
app.send_inline_bot_result(
|
|
"me",
|
|
bot_results.query_id,
|
|
bot_results.results[0].id
|
|
)
|
|
|
|
.. figure:: https://i.imgur.com/wwxr7B7.png
|
|
:width: 90%
|
|
:align: center
|
|
:figwidth: 60%
|
|
|
|
``send_inline_bot_result()`` is the equivalent action of choosing a result from the list and sending it
|
|
to a chat.
|