mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
Created Talking to inline bots (markdown)
parent
534cbecfa8
commit
3c5096c8bd
24
Talking-to-inline-bots.md
Normal file
24
Talking-to-inline-bots.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
You can query an inline bot, such as [@vote](https://t.me/vote), by making use of the [`GetInlineBotResultsRequest`](https://lonamiwebs.github.io/Telethon/methods/messages/get_inline_bot_results.html) request:
|
||||
|
||||
```python
|
||||
from telethon.tl.functions.messages import GetInlineBotResultsRequest
|
||||
from telethon.helpers import get_input_peer
|
||||
|
||||
bot_results = client.invoke(GetInlineBotResultsRequest(
|
||||
get_input_peer(bot), get_input_peer(user_or_chat), 'query', ''
|
||||
))
|
||||
```
|
||||
|
||||
And you can reply to their results by using [`SendInlineBotResultRequest`](https://lonamiwebs.github.io/Telethon/methods/messages/send_inline_bot_result.html):
|
||||
|
||||
```python
|
||||
from telethon.tl.functions.messages import SendInlineBotResultRequest
|
||||
from telethon.utils import generate_random_long
|
||||
|
||||
client.invoke(SendInlineBotResultRequest(
|
||||
get_input_peer(user_or_chat),
|
||||
generate_random_long(),
|
||||
obtained_query_id,
|
||||
obtained_str_id
|
||||
))
|
||||
```
|
Loading…
Reference in New Issue
Block a user