简体   繁体   中英

Telegram Bot running on PyTelegramBotAPI is incorrectly getting forwarded messages

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

if you using pytelegrambotapi you shoud type like this (below handler) and if you send numbers in 1 message

bot.send_message(message.chat.id, message.text, <keyboard>)

else - if you send numbers in more message -

trying to concatenation several messages to tuple and send it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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