I am forwarding messages to bot. Then bot simple prints it to my console (for the first time). Then, let’s look at the example:
FORWARDING:
1
2
3
4
5
BOT OUTPUTS:
2
1
4
3
5
The main problem is that the hierarchy of these messages is wrong. And it’s always different, it can be even correct, but rarely…
Question:
How to correctly get all messages with correct hierarchy?
Code that I use:
@bot.message_handler(func=lambda message: message.forward_from != None) # handles only forwarded messages
def newPost(message):
print(message.text)
Info:
Python 3, PyTelegramBotAPI