Created
October 4, 2016 21:12
-
-
Save adastreamer/64a35e13803ca46a7acdf0cf1d62dd0c to your computer and use it in GitHub Desktop.
Inline pictures telegram bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = u'https://api.cognitive.microsoft.com/bing/v5.0/images/search?count=10&q={}'.format(inline_query) | |
r = requests.post(url, headers=HEADERS) | |
j = r.json() | |
images = j['value'] | |
for im in images: | |
results.append(InlineQueryResultPhoto( | |
id=uuid4(), | |
photo_url=im['contentUrl'], | |
thumb_url=im['contentUrl'] | |
)) | |
bot.answerInlineQuery(inline_id, results=results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment