Update GroupChat.js

This commit is contained in:
Rajeh Taher
2022-08-09 13:50:56 +03:00
committed by GitHub
parent a9bbc0ed99
commit 1f80a86962

View File

@@ -59,18 +59,19 @@ class GroupChat extends Chat {
* @param {string} type (promote|demote|add|remove)
*/
async _changeParticipants(participantIds, type, sleep = null) {
return await this.client.pupPage.evaluate(async (chatId, participantIds, sleep) => {
return await this.client.pupPage.evaluate(async (chatId, participantIds, type, sleep) => {
if (type != 'add' && type != 'remove' && type != 'promote' && type != 'demote') return null;
const chatWid = window.Store.WidFactory.createWid(chatId);
const participantWids = participantIds.map(p => window.Store.WidFactory.createWid(p));
const status = [];
for (const participantWid of participantWids) {
status.push(await window.Store.GroupParticipants.['send'+type.charAt(0).toUpperCase() + type.slice(1)+'Participants'](chatWid, [participantWid]));
status.push(await window.Store.GroupParticipants['send'+type.charAt(0).toUpperCase() + type.slice(1)+'Participants'](chatWid, [participantWid]));
if (sleep) {
await Util.sleep(sleep);
}
}
return status;
}, this.id._serialized, participantIds, sleep);
}, this.id._serialized, participantIds, type, sleep);
}
/**