You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Pyrogram中phone_number显示为*********?get_chat_members返回星号而非手机号

Pyrogram中get_chat_members返回的phone_number显示为*********的原因

这是Telegram API的限制导致的,和Pyrogram本身无关。只有满足以下任一条件,才能获取到用户的真实手机号:

  • 该用户是你设备通讯录里的联系人(对应User对象的is_contact字段为true)
  • 你和该用户互为联系人(is_mutual_contact字段为true)
  • 你是目标超级群/频道的管理员,且拥有查看成员手机号的权限(仅限群聊场景)

从你提供的User对象数据来看,is_contact和is_mutual_contact都为false,所以Telegram不会返回真实手机号,只会用*********占位。

你提供的User对象数据:

"_": "User",
"id": ##########,
"is_self": true,
"is_contact": false,
"is_mutual_contact": false,
"is_deleted": false,
"is_bot": false,
"is_verified": false,
"is_restricted": false,
"is_scam": false,
"is_fake": false,
"is_support": false,
"is_premium": false,
"first_name": "#########",
"last_name": "###########",
"status": "UserStatus.OFFLINE",
"last_online_date": "2023-01-13 16:18:34",
"username": "###########",
"phone_number": "*********"

内容的提问来源于stack exchange,提问作者listcool

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 23:50:35