def inline(bot, update): #Inline Handler & Parser
query = update.inline_query.query
if query is None:
query = 'rating:s'
client = Pybooru('Yandere')
posts = client.posts_list(tags=query, limit=50)
lposts = len(posts)
inlinequery = list()
reply_markup = InlineKeyboardMarkup([InlineKeyboardButton("More", callback_data='More')])
for post in posts:
inlinequery.append(InlineQueryResultPhoto(
type='photo',
id=uuid4(),
photo_url=post['file_url'],
photo_width=post['preview_width']*6,
photo_height=post['preview_height']*6,
#reply_markup=reply_markup,
thumb_url=post['preview_url']),)
bot.answerInlineQuery(update.inline_query.id, results=inlinequery, switch_pm_text="Help", switch_pm_parameter="ihelp")
inlinequery.clear()
else:
client = Pybooru('Yandere')
posts = client.posts_list(tags=query, limit=50)
lposts = len(posts)
inlinequery = list()
reply_markup = InlineKeyboardMarkup([InlineKeyboardButton("More", callback_data='More')])
for post in posts:
inlinequery.append(InlineQueryResultPhoto(
type='photo',
id=uuid4(),
photo_url=post['file_url'],
photo_width=post['preview_width']*6,
photo_height=post['preview_height']*6,
#reply_markup=reply_markup,
thumb_url=post['preview_url']),)
bot.answerInlineQuery(update.inline_query.id, results=inlinequery, switch_pm_text="Help", switch_pm_parameter="ihelp")
inlinequery.clear()
评论列表
文章目录