Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @bot.message_handler(content_types=['text'])
- def send_rand_photo(message):
- if message.text =='фото':
- keyboard = types.InlineKeyboardMarkup()
- like_button= types.InlineKeyboardButton(text="Like")
- keyboard.add(like_button)
- dislike_button =types.InlineKeyboardButton (text="Dislike")
- keyboard.add(like_button)
- all_photo_in_directory=os.listdir(PATH)
- random_photo=random.choice (all_photo_in_directory)
- img=open (PATH + '/' +random_photo, 'rb')
- bot.send_chat_action(message.from_user.id,'upload_photo')
- bot.send_photo(message.from_user.id,img)
- img.close()
Add Comment
Please, Sign In to add comment