Guest User

Untitled

a guest
Feb 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. @bot.message_handler(content_types=['text'])
  2. def send_rand_photo(message):
  3. if message.text =='фото':
  4. keyboard = types.InlineKeyboardMarkup()
  5. like_button= types.InlineKeyboardButton(text="Like")
  6. keyboard.add(like_button)
  7. dislike_button =types.InlineKeyboardButton (text="Dislike")
  8. keyboard.add(like_button)
  9. all_photo_in_directory=os.listdir(PATH)
  10. random_photo=random.choice (all_photo_in_directory)
  11. img=open (PATH + '/' +random_photo, 'rb')
  12. bot.send_chat_action(message.from_user.id,'upload_photo')
  13. bot.send_photo(message.from_user.id,img)
  14. img.close()
Add Comment
Please, Sign In to add comment