pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

A full example of InlineQueryResultArticle (Thumbnail and link included)

Open alfilesnet opened this issue 9 years ago • 1 comments

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using? 3.0.1
  2. What OS are you using? Ubuntu 16.04 LTE
  3. What version of python are you using? 3.5.2

-- coding: utf-8 --

#!/usr/bin/python import telebot from telebot import types

TOKEN = '' #Your Token bot = telebot.TeleBot(TOKEN) bot.skip_pending=True

@bot.inline_handler(lambda query: query.query == 'text') def query_article(inline_query):

try:
	results_list=[]					

	# You can do a "for e,row in enumerate(db_results):" to get the data faster
	resultados.append(types.InlineQueryResultArticle('1', 'Title 1', types.InputTextMessageContent('Thanks for visit me'), None, 'http://telegram.org', True,  'Subtitle 1', 'https://telegram.org/img/t_logo.png',640, 640))
	resultados.append(types.InlineQueryResultArticle('2', 'Title 2', types.InputTextMessageContent('Thanks for visit me'), None, 'http://google.com', True,  'Subtitle 2', 'http://pbs.twimg.com/profile_images/848204538163195907/14Mw9m9Z.jpg',640, 640))
			
	bot.answer_inline_query(inline_query.id, results=results_list, cache_time=1)

except Exception as e:
	print(e)

bot.polling(none_stop=True)

alfilesnet avatar Jun 26 '17 22:06 alfilesnet

hm, not works now

olekshchavelev avatar Aug 13 '19 09:08 olekshchavelev