S
S
sashx2021-11-21 08:52:11
Python
sashx, 2021-11-21 08:52:11

How to use sendMediaGroup method in Telebot?

Hello! Can you tell me how can I use the sendMediaGroup method in Telebot? The documentation specifies a list that contains the media data. In this case, the usual list of links to photos returns an error. What is the problem?

6199de8312758776787774.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-11-21
@sashx

In this case, the usual list of links to photos returns an error. What is the problem?

The fact that the method does not accept a list of links to the photo. You yourself attached a screenshot from the documentation.
The parameter mediaaccepts a list of types
InputMediaAudio, InputMediaDocument, InputMediaPhoto and InputMediaVideo
. Open the type you need in the documentation and see what parameters it takes
https://core.telegram.org/bots/api#inputmediaphoto
Let's say that the InputMediaPhoto type has parameters media, captionand parse_mode.
All types in Telebot lie intelebot.types
medias = [types.InputMediaPhoto('https://habrastorage.org/webt/61/99/de/6199de8312758776787774.png'), types.InputMediaPhoto('https://habrastorage.org/getpro/habr/upload_files/1fd/40a/c44/1fd40ac441a0aee55fc90e67997437af.png')]
bot.send_media_group(chat_id, medias)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question