How to send telegram mediaGroup with caption/text

痞子三分冷 提交于 2021-02-08 14:59:27

问题


I'm currently using python-telegram-bot and basically what I want to achieve with it is to send telegram messages like this:

So the message consists of 2+ photos/videos with text message underneath.

What I've already tried:

  1. sending message with send_message method, and including photo URLs, but it only shows 1 picture which is under the text

  2. sending media group using send_media_group, but this method has no caption parameter as send_photo.


回答1:


You should use sendMediaGroup, where you can specify media field with an array of photo/video objects but the trick is to set caption property only for the first element of an array. In this case telegram will show that caption below the media content.

If you'll specify captions for more than one element telegram will show them only when you click on photo preview for each photo separately.



来源:https://stackoverflow.com/questions/58893142/how-to-send-telegram-mediagroup-with-caption-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!