Python 电报机器人。获取给定消息回复的消息

Python Telegram Bot. Get message to which given message replies

我想开发一个 Telegram 机器人,作为书签系统。它应该处理回复其他消息的命令。实例:

我使用 python-telegram-bot 进行开发,但似乎无法看到 /important 回复的那条消息。我找到了 Update.message.reply_to_message 对象,它仅在用户回复来自机器人本身的消息时起作用。

def important_handler(update: Update, context: CallbackContext):
    reply_to_message = update.message.reply_to_message
    if reply_to_message is None:
        logger.error('reply_to_message is None. But it shouldn\'t.')
        update.message.reply_text('There is no message attached. Try again.')
        return
    # ... business logic

有没有办法为所有回复获取 reply_to_message 属性(或替代属性)?感谢您的建议;)

我遇到了同样的问题。它仅在用户回复机器人时有效。我的问题是该机器人通过 /setprivacy 获得了 Privacy Mode enabled. Once I disabled it with Botfather 然后它起作用了。