Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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):

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. E.g. if user have sent a message with 3 photos, then the bot forwards 3 messages, each of which contains a photo.

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.

Thanks in advance.

like image 294
phbelov Avatar asked Dec 10 '17 21:12

phbelov


People also ask

Can telegram bot forward messages?

Any message from other users that can be seen by a Telegram bot can be forwarded both to another chat and even outside the Telegram platform, for this case, the different integrations of Botize will help you achieve it as we will also see below.

How many messages can a telegram bot send?

Also note that your bot will not be able to send more than 20 messages per minute to the same group.

What is forward cover bot in Telegram?

This telegram bot just echoes any message you send it or modify for him. If you don't like telegram forwards, before sending a message, send the message to the bot, then forward the message that the bot returns to the user you were chatting with.


2 Answers

You can't forward original content via forwardMessage, for instance, you can't forward with an inline keyboard.

I think this may be a mistake, you can suggest that to @BotSupport.

like image 155
Sean Avatar answered Oct 19 '22 07:10

Sean


Telegram API had updated a method call sendMediaGroup for sending images as album.

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

Have a look :)

like image 31
user11060949 Avatar answered Oct 19 '22 05:10

user11060949