From c8de368f87676e6a2b1d7b778eba519a11ba8e23 Mon Sep 17 00:00:00 2001 From: Mr_Red <70178924+Sadgman@users.noreply.github.com> Date: Thu, 30 May 2024 18:20:09 -0400 Subject: [PATCH] Add admin check in GroupChat.js This commit introduces an additional check in the GroupChat.js file to determine if a client is an admin. --- src/structures/GroupChat.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/structures/GroupChat.js b/src/structures/GroupChat.js index 2c165e5b6..8833643ec 100644 --- a/src/structures/GroupChat.js +++ b/src/structures/GroupChat.js @@ -183,7 +183,17 @@ class GroupChat extends Chat { return participantData; }, this.id._serialized, participantIds, options); } - + /** + * Checks if the client is an admin in the group{ + * @returns {Promise<{ status: boolean}>} + */ + async iAmadmin() { + return await this.client.pupPage.evaluate(async (groupId) => { + const chatWid = window.Store.WidFactory.createWid(groupId); + const chat = await window.Store.Chat.find(chatWid); + return chat.iAmAdmin(); + }, this.id._serialized) + } /** * Removes a list of participants by ID to the group * @param {Array} participantIds