From 3c5096c8bd453816e279231c421e4749611c8753 Mon Sep 17 00:00:00 2001 From: Lonami Date: Fri, 9 Jun 2017 17:08:53 +0200 Subject: [PATCH] Created Talking to inline bots (markdown) --- Talking-to-inline-bots.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Talking-to-inline-bots.md 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