Fixed profile description not saving when user has avatar.

This commit is contained in:
ThePendulum 2018-04-30 14:17:44 +02:00
parent 9c388f04c7
commit 632dc96bc1
2 changed files with 9 additions and 10 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules/
config/*.js
!config/default.js
output/
dist/

View File

@ -14,18 +14,16 @@ function saveProfileDetails(user) {
if(config.library.profile.avoidAvatar && new urlPattern('http(s)\\://(www.)redditstatic.com/avatars/:id(.:ext)(?:query)').match(image)) {
console.log('\x1b[33m%s\x1b[0m', `Ignoring standard avatar profile image for '${user.name}'`);
} else {
const filepath = interpolate(config.library.profile.image, user, null, {
// pass profile image as item to interpolate extension variable
url: image
});
return user;
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}`);
});
}
const filepath = interpolate(config.library.profile.image, user, null, {
// pass profile image as item to interpolate extension variable
url: image
});
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) {