image_folder = 'D:/фотки для питона'
images = [os.path.join(image_folder, f) for f in os.listdir(image_folder) if f.endswith('.jpg')]
@bot.message_handler()
def get_user_text(message):
if message.text == "привет":
bot.send_message(message.chat.id, "Приветсвую", parse_mode='html')
elif message.text == 'получить фото':
photo = open(random.choice(images), 'rb')
bot.send_photo(message.chat.id, photo, caption='Лови')
elif message.text == "рандомные фото":
photos = [open(image, 'rb') for image in random.sample(images, 3)]
bot.send_media_group(message.chat.id, [telebot.types.InputMediaPhoto(photo) for photo in photos])