From 1f80a86962b0e8c6973728542aef85605843aec3 Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Tue, 9 Aug 2022 13:50:56 +0300 Subject: [PATCH] Update GroupChat.js --- src/structures/GroupChat.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/structures/GroupChat.js b/src/structures/GroupChat.js index 07ff42e..9d13d48 100644 --- a/src/structures/GroupChat.js +++ b/src/structures/GroupChat.js @@ -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); } /**