mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
Update GroupChat.js
This commit is contained in:
@@ -59,9 +59,13 @@ class GroupChat extends Chat {
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async addParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.addParticipants(chatId, participantIds);
|
||||
}, this.id._serialized, participantIds);
|
||||
let data = [];
|
||||
for (let participantId of participantIds){
|
||||
data.push(await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.addParticipants(chatId, participantIds);
|
||||
}, this.id._serialized, participantIds));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,9 +74,13 @@ class GroupChat extends Chat {
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async removeParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.removeParticipants(chatId, participantIds);
|
||||
}, this.id._serialized, participantIds);
|
||||
let data = [];
|
||||
for (let participantId of participantIds){
|
||||
data.push(await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.removeParticipants(chatId, participantIds);
|
||||
}, this.id._serialized, participantIds));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,9 +89,13 @@ class GroupChat extends Chat {
|
||||
* @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful
|
||||
*/
|
||||
async promoteParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.promoteParticipants(chatId, participantIds);
|
||||
}, this.id._serialized, participantIds);
|
||||
let data = [];
|
||||
for (let participantId of participantIds){
|
||||
data.push(await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.promoteParticipants(chatId, participantIds);
|
||||
}, this.id._serialized, participantIds));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,9 +104,13 @@ class GroupChat extends Chat {
|
||||
* @returns {Promise<{ status: number }>} Object with status code indicating if the operation was successful
|
||||
*/
|
||||
async demoteParticipants(participantIds) {
|
||||
return await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.demoteParticipants(chatId, participantIds);
|
||||
}, this.id._serialized, participantIds);
|
||||
let data = [];
|
||||
for (let participantId of participantIds){
|
||||
data.push(await this.client.pupPage.evaluate((chatId, participantIds) => {
|
||||
return window.Store.Wap.demoteParticipants(chatId, participantIds);
|
||||
}, this.id._serialized, participantIds));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,4 +214,4 @@ class GroupChat extends Chat {
|
||||
|
||||
}
|
||||
|
||||
module.exports = GroupChat;
|
||||
module.exports = GroupChat;
|
||||
|
||||
Reference in New Issue
Block a user