我如何获取转发器消息名称python pytelegrambotapi

时间:2020-08-27 16:51:26

标签: python api telegram-bot py-telegram-bot-api

因此,当从其他用户向机器人转发消息时,机器人应获得原始的转发发件人姓名

我在文档中尝试过:

reply_to_id = message.forward_sender_name

但是我得到了这个错误: 'Message' object has no attribute 'forward_sender_name'

我可以从转发的邮件中获取用户的原始名字吗?

我正在使用 python 3.7 pytelegrambotapi

1 个答案:

答案 0 :(得分:0)

您将阅读Telegram Bot API文档。在pyTelegramBotAPI中,使用forward_from代替message.forward_sender_name

reply_to_id = message.forward_from.first_name + messge.forward_from.last_name
相关问题