J'envoie InlineQueryResultArticle
aux clients et je me demande comment obtenir le résultat et ses données (comme result_id, ...).Télégramme bot: Comment obtenir le résultat en ligne choisi
est ici le code pour envoyer les résultats:
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)
Je suis à la recherche d'une méthode comme on_inline_chosen(data)
pour obtenir id de l'élément choisi. (1000 or 1001
pour l'extrait ci-dessus), puis envoyez la réponse appropriée à l'utilisateur.
Merci, mais je suis Je me demande comment implémenter 'on_inline_result_selected()' dans le code. –