在电报中使用 getUserProfilePhotos 获取图片个人资料用户

Get picture profile user with getUserProfilePhotos in Telegram

我正在尝试使用 getUserProfilePhotos 方法保存 Telegram 机器人(游戏)用户的照片 我正在用我自己的 id_user 测试它。代码:

    def getUserProfilePicture (self, user : User):
        if (user is None) : return None
        requestStr = self.httpbase + self.token + "/getUserProfilePhotos"
        par ={
            "user_id" : user.id, #correct id passed.
            "limit" : 5
        }
        dataReq = requests.post(requestStr, json=par)
        updateData = json.loads(dataReq.content)
        isOk = updateData.get("ok")

结果(我也尝试过使用 Postman,传递我的用户 ID,有和没有 limit 参数):

{
    "ok": true,
    "result": {
        "total_count": 0,
        "photos": []
    }
}

这不是正确的结果。在我的个人资料中,我有 3 张图片。我尝试过使用其他配置文件,结果是一样的:0 个图像和一个空数组。 link到API如下:link getUserProfilePhotos method

有什么想法吗?

谢谢。

如果您的隐私设置规定只有您的联系人可以看到您的个人资料图片,则机器人无法看到您的个人资料图片(因为您无法将其添加为联系人)。

评论的时候忘记了……