简体   繁体   English

使用bot Telegram API转发包含多个媒体文件的消息

[英]Forward a message with multiple media files using bot Telegram API

I'm having a problem forwarding messages with multiple media files (in my particular case, photos). 我在使用多个媒体文件转发邮件时遇到问题(在我的特定情况下,照片)。

I'm using forwardMessage method to forward the message that user sends to bot (which, in some cases, might contain more than one photo): 我正在使用forwardMessage方法转发用户发送到bot的消息(在某​​些情况下,可能包含多张照片):

bot.forwardMessage(admin_id, from_chat_id, message_id)

But, the thing is, according to Telegram API v3.5, the message which contain media group breaks up into array of messages, and hence the bot breaks up the message from user into multiple messages. 但是,根据Telegram API v3.5,包含媒体组的消息会分解为消息数组,因此机器人会将消息从用户分解为多条消息。 Eg if user have sent a message with 3 photos, then the bot forwards 3 messages, each of which contains a photo. 例如,如果用户发送了包含3张照片的消息,则机器人会转发3条消息,每条消息都包含一张照片。

What I want is to forward a message with multiple media files as it is, as one message, not as multiple messages. 我想要的是将具有多个媒体文件的消息原样转发为一条消息,而不是多条消息。

I know that probably I can take each photo from each message that the bot receives, put them one-by-one into array, and then send it from the bot using sendMediaGroup method, but I'd like to know if I can get it working with forwardMessage method. 我知道可能我可以从机器人收到的每条消息中取出每张照片,将它们逐个放入数组中,然后使用sendMediaGroup方法从机器人发送它,但我想知道我是否可以获取它使用forwardMessage方法。

Thanks in advance. 提前致谢。

You can't forward original content via forwardMessage , for instance, you can't forward with an inline keyboard. 您无法通过forwardMessage转发原始内容,例如,您无法使用内联键盘转发。

I think this may be a mistake, you can suggest that to @BotSupport . 我认为这可能是一个错误,你可以建议@BotSupport

Telegram API had updated a method call sendMediaGroup for sending images as album. Telegram API更新了一个方法调用sendMediaGroup,用于将图像作为专辑发送。

https://core.telegram.org/bots/api#sendmediagroup https://core.telegram.org/bots/api#sendmediagroup

Have a look :) 看一看 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM