diff --git a/examples/inline_example.py b/examples/inline_example.py index c62432d..c4192e1 100644 --- a/examples/inline_example.py +++ b/examples/inline_example.py @@ -5,7 +5,7 @@ import sys import logging from telebot import types -API_TOKEN = '' +API_TOKEN = '' bot = telebot.TeleBot(API_TOKEN) telebot.logger.setLevel(logging.DEBUG) @@ -14,23 +14,24 @@ telebot.logger.setLevel(logging.DEBUG) @bot.inline_handler(lambda query: query.query == 'text') def query_text(inline_query): try: - r = types.InlineQueryResultArticle('1', 'Result', inline_query.query) - r2 = types.InlineQueryResultArticle('2', 'Result2', inline_query.query) + r = types.InlineQueryResultArticle('1', 'Result1', types.InputTextMessageContent('hi')) + r2 = types.InlineQueryResultArticle('2', 'Result2', types.InputTextMessageContent('hi')) bot.answer_inline_query(inline_query.id, [r, r2]) except Exception as e: print(e) -@bot.inline_handler(lambda query: query.query == 'photo') +@bot.inline_handler(lambda query: query.query == 'photo1') def query_photo(inline_query): try: r = types.InlineQueryResultPhoto('1', 'https://raw.githubusercontent.com/eternnoir/pyTelegramBotAPI/master/examples/detailed_example/kitten.jpg', - 'https://raw.githubusercontent.com/eternnoir/pyTelegramBotAPI/master/examples/detailed_example/kitten.jpg') + 'https://raw.githubusercontent.com/eternnoir/pyTelegramBotAPI/master/examples/detailed_example/kitten.jpg', + input_message_content=types.InputTextMessageContent('hi')) r2 = types.InlineQueryResultPhoto('2', 'https://raw.githubusercontent.com/eternnoir/pyTelegramBotAPI/master/examples/detailed_example/rooster.jpg', 'https://raw.githubusercontent.com/eternnoir/pyTelegramBotAPI/master/examples/detailed_example/rooster.jpg') - bot.answer_inline_query(inline_query.id, [r, r2]) + bot.answer_inline_query(inline_query.id, [r, r2], cache_time=1) except Exception as e: print(e)