N
N
Nikita2020-11-02 19:13:48
Python
Nikita, 2020-11-02 19:13:48

How to send multiple photos in one message (Telegram-Bot)?

How to send several photos in one message with a Telegram bot?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
o5a, 2020-11-03
@VinchesTer312

you need to pass a list of InputMediaPhoto objects

bot.send_media_group(message.chat.id,
    [telebot.types.InputMediaPhoto(open(photo, 'rb')) for photo in ['photo1', 'photo2']])

T
TupaBan Dev, 2020-11-02
@TupaBan

You didn't specify the library you're working on!
But for TeleBot it is done like this:

else:
    bot.send_photo(message.chat.id, open('название фото1.png', 'rb'))
    bot.send_photo(message.chat.id, open('название фото2.png', 'rb'))
    bot.send_photo(message.chat.id, open('название фото3.png', 'rb'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question