mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
Feat: change profile/group picture (#1916)
* feat: pfp * Make eslint happy * Fix typo * Fix missing comma * Update src/util/Injected.js * ESLint * Update src/util/Injected.js * mfw purp breaks indentation --------- Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
@@ -1178,6 +1178,31 @@ class Client extends EventEmitter {
|
||||
|
||||
return blockedContacts.map(contact => ContactFactory.create(this.client, contact));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current user's profile picture.
|
||||
* @param {MessageMedia} media
|
||||
* @returns {Promise<boolean>} Returns true if the picture was properly updated.
|
||||
*/
|
||||
async setProfilePicture(media) {
|
||||
const success = await this.pupPage.evaluate((chatid, media) => {
|
||||
return window.WWebJS.setPicture(chatid, media);
|
||||
}, this.info.wid._serialized, media);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the current user's profile picture.
|
||||
* @returns {Promise<boolean>} Returns true if the picture was properly deleted.
|
||||
*/
|
||||
async deleteProfilePicture() {
|
||||
const success = await this.pupPage.evaluate((chatid) => {
|
||||
return window.WWebJS.deletePicture(chatid);
|
||||
}, this.info.wid._serialized);
|
||||
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Client;
|
||||
|
||||
Reference in New Issue
Block a user