Update GroupChat.js

This commit is contained in:
Rajeh Taher
2022-01-29 01:54:30 +02:00
committed by GitHub
parent 4e6a00dffe
commit cf5c5e4ec1

View File

@@ -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;