如果我有错误,我该如何forward_name?

发布于 2025-01-23 02:22:55 字数 230 浏览 1 评论 0原文

我在Python Telegram bot上写。我需要获取用户和他的ID的名称,他的信息通过单词命令回答。 我有一个代码,两个人交互,发件人的名称和ID正常显示,但问题是第二个不起作用。

bot.send_message(message.chat.id, "[{0.first_name}](tg://user?id={0.id}) killed [{1.first_name}](tg://user?id={1.id}) 
              

I write on the Python Telegram bot. And I need to get the name of the user and his id, whose message was answered with the word-command.
I have a code in which two people interact, the sender's name and id are displayed normally, but the problem is that the second does not work.

bot.send_message(message.chat.id, "[{0.first_name}](tg://user?id={0.id}) killed [{1.first_name}](tg://user?id={1.id}) ????".format(message.from_user, message.forward_from),
    parse_mode='MarkdownV2')

And the console displays this error

AttributeError: 'NoneType' object has no attribute 'first_name'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文