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:
Wictor Nogueira 2023-03-31 22:21:09 -03:00 • committed by GitHub
commit dc16bbbdac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -213,6 +213,31 @@ class GroupChat extends Chat {
return true;
}
/**
* Deletes the group's picture.
* @returns {Promise<boolean>} Returns true if the picture was properly deleted. This can return false if the user does not have the necessary permissions.
*/
async deletePicture() {
const success = await this.client.pupPage.evaluate((chatid) => {
return window.WWebJS.deletePicture(chatid);
}, this.id._serialized);
return success;
}
/**
* Sets the group's picture.
* @param {MessageMedia} media
* @returns {Promise<boolean>} Returns true if the picture was properly updated. This can return false if the user does not have the necessary permissions.
*/
async setPicture(media) {
const success = await this.client.pupPage.evaluate((chatid, media) => {
return window.WWebJS.setPicture(chatid, media);
}, this.id._serialized, media);
return success;
}
/**
* Gets the invite code for a specific group
* @returns {Promise<string>} Group's invite code