Dealing with users without profile.
This commit is contained in:
@@ -9,18 +9,20 @@ const save = require('./save.js');
|
||||
|
||||
function saveProfileDetails(user) {
|
||||
if(config.library.profile.image) {
|
||||
const image = user.profile ? user.profile.image : user.image;
|
||||
|
||||
const filepath = interpolate(config.library.profile.image, user, null, {
|
||||
// pass profile image as item to interpolate extension variable
|
||||
url: user.profile.image
|
||||
url: image
|
||||
});
|
||||
|
||||
fetchItem(user.profile.image).then(stream => save(filepath, stream)).catch(error => {
|
||||
fetchItem(image).then(stream => save(filepath, stream)).catch(error => {
|
||||
console.log('\x1b[33m%s\x1b[0m', `Could not save profile image for '${user.name}': ${error}`);
|
||||
});
|
||||
}
|
||||
|
||||
if(config.library.profile.description) {
|
||||
if(user.profile.description) {
|
||||
if(user.profile && user.profile.description) {
|
||||
const filepath = interpolate(config.library.profile.description, user);
|
||||
const stream = textToStream(user.profile.description);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user