Skip to content

Instantly share code, notes, and snippets.

@adastreamer
Created October 4, 2016 21:12
Show Gist options
  • Save adastreamer/64a35e13803ca46a7acdf0cf1d62dd0c to your computer and use it in GitHub Desktop.
Save adastreamer/64a35e13803ca46a7acdf0cf1d62dd0c to your computer and use it in GitHub Desktop.
Inline pictures telegram bot
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