Open ghost opened 4 years ago
If you really need this feature, you can use this code
I know it isn't good solution, but i couldn't find another way to resolve your problem.
i'm not sure how defaultFuncs
works
"use strict";
var utils = require("facebook-chat-api/utils");
var log = require("npmlog");
module.exports = function(defaultFuncs, api, ctx) {
return function getUserPhoto(id, callback) {
if (!callback) {
throw { error: "getUserPhoto: need callback" };
}
defaultFuncs
.get("https://graph.facebook.com/v5.0/" + id + "/picture?type=large&width=4096")
.then(function(resData) {
if (resData.error) {
throw resData;
}
callback(null, {userID: id, photoUrl: resData.request.href});
})
.catch(function(err) {
log.error("getUserPhoto", err);
return callback(err);
});
};
};
This function returns object with 2 params (userID, photoUrl). photoURL gives you original photo
Now there is only
thumbSrc
in getUserInfo(), which is a very small profile picture (32x32px), I think addingprofilePicture
can be useful.