diff --git a/Talking-to-inline-bots.md b/Talking-to-inline-bots.md new file mode 100644 index 0000000..3abf45e --- /dev/null +++ b/Talking-to-inline-bots.md @@ -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 +)) +``` \ No newline at end of file