I’ve created a bot to gather information in which users will forward messages to the bot from any other telegram chat/channel/group.
The forwarded messages can be of types video,photo,audio and url or any combination of these.
Below is where I am looking at:
https://core.telegram.org/bots/api#available-types
Right now I have (on Python)—>
@bot.message_handler(content_types=["video", "photo", "audio", "link"])
def send_welcome(message):
bot.reply_to(message, "got it")
BUT since there is no link content type, when the user forwards only a link, this doesn’t work.
I’m looking for some property like forward_status = True if it exists.
3
Answers
I have found a workaround since I've decided to collect forwarded messages in text format as well.
This will identify any forwarded messages in the text format.
According to the line
@bot.message_handler(content_types=["video", "photo", "audio", "link"])
I suppose you are using pyTelegramBotAPIThis package allows you to create custom filters. Here you can find examples of how to create your own filters and how to register them. Actually, the package already has such filter –
telebot.custom_filters.ForwardFilter
(docs, source code)Instance
message.message_id
is used to store a specific message ID in a certain user chat, then your bot should forward any message content of media, link, text or another available type, you could try whatever the bot configuration have to integrate these functions just as a simple demostration of your problem and different options frommessage
, check message test for additional information.image