diff --git a/index.d.ts b/index.d.ts index 1fa0a1e..1c61870 100644 --- a/index.d.ts +++ b/index.d.ts @@ -10,6 +10,9 @@ declare namespace WAWebJS { /**Accepts an invitation to join a group */ acceptInvite(inviteCode: string): Promise + /**Returns an object with information about the invite code's group */ + getInviteInfo(inviteCode: string): Promise + /** Enables and returns the archive state of the Chat */ archiveChat(): Promise diff --git a/src/Client.js b/src/Client.js index 74d9e72..26a93dc 100644 --- a/src/Client.js +++ b/src/Client.js @@ -478,6 +478,17 @@ class Client extends EventEmitter { return ContactFactory.create(this, contact); } + /** + * Returns an object with information about the invite code's group + * @param {string} inviteCode + * @returns {Promise} Invite information + */ + async getInviteInfo(inviteCode) { + return await this.pupPage.evaluate(inviteCode => { + return window.Store.Wap.groupInviteInfo(inviteCode); + }, inviteCode); + } + /** * Accepts an invitation to join a group * @param {string} inviteCode Invitation code diff --git a/src/structures/GroupChat.js b/src/structures/GroupChat.js index 055e05f..8fc95cc 100644 --- a/src/structures/GroupChat.js +++ b/src/structures/GroupChat.js @@ -136,27 +136,6 @@ class GroupChat extends Chat { }, this.id._serialized); } - /** - * Returns an object with information about the invite code's group - * @param {string} inviteCode - * @returns {Promise} Invite information - */ - static async getInviteInfo(inviteCode) { - return await this.client.pupPage.evaluate(inviteCode => { - return window.Store.Wap.groupInviteInfo(inviteCode); - }, inviteCode); - } - - /** - * Joins a group with an invite code - * @param {string} inviteCode - */ - static async join(inviteCode) { - return await this.client.pupPage.evaluate(inviteCode => { - return window.Store.Wap.acceptGroupInvite(inviteCode); - }, inviteCode); - } - /** * Makes the bot leave the group */