Ali*_*fat 3 python-telegram-bot telegram-bot
我正在发送InlineQueryResultArticle给客户,我想知道如何获得选定的结果及其数据(如 result_id,...)。
这是发送结果的代码:
token = 'Bot token'
bot = telegram.Bot(token)
updater = Updater(token)
dispatcher = updater.dispatcher
def get_inline_results(bot, update):
query = update.inline_query.query
results = list()
results.append(InlineQueryResultArticle(id='1000',
title="Book 1",
description='Description of this book, author ...',
thumb_url='https://fakeimg.pl/100/?text=book%201',
input_message_content=InputTextMessageContent(
'chosen book:')))
results.append(InlineQueryResultArticle(id='1001',
title="Book 2",
description='Description of the book, author...',
thumb_url='https://fakeimg.pl/300/?text=book%202',
input_message_content=InputTextMessageContent(
'chosen book:')
))
update.inline_query.answer(results)
inline_query_handler = InlineQueryHandler(get_inline_results)
dispatcher.add_handler(inline_query_handler)
Run Code Online (Sandbox Code Playgroud)
我正在寻找一种方法on_inline_chosen(data)来获取所选项目的 id。(1000 or 1001对于上面的代码段),然后向用户发送适当的响应。
| 归档时间: |
|
| 查看次数: |
2654 次 |
| 最近记录: |