diff --git a/src/structures/GroupChat.js b/src/structures/GroupChat.js index 76ff151..7ebb15f 100644 --- a/src/structures/GroupChat.js +++ b/src/structures/GroupChat.js @@ -59,9 +59,13 @@ class GroupChat extends Chat { * @returns {Promise} */ 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} */ 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; \ No newline at end of file +module.exports = GroupChat;