mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
feat: acceptGroupV4Invite (#677)
* Added option client.acceptGroupV4Invite() * Update Client.js * Update index.d.ts Added a description to the inviteV4 object Renamed "invite" by "inviteV4" * Update Client.js * Update Message.js renamed "invite" to "inviteV4" * Update Client.js * Added message.acceptGroupV4Invite method * Update index.d.ts acceptGroupV4Invite * better typings, refactor some names Co-authored-by: Pedro Lopez <pedroslopez@me.com>
This commit is contained in:
@@ -607,6 +607,20 @@ class Client extends EventEmitter {
|
||||
return chatId._serialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts a private invitation to join a group
|
||||
* @param {object} inviteV4 Invite V4 Info
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
async acceptGroupV4Invite(inviteInfo) {
|
||||
if(!inviteInfo.inviteCode) throw 'Invalid invite code, try passing the message.inviteV4 object';
|
||||
if (inviteInfo.inviteCodeExp == 0) throw 'Expired invite code';
|
||||
return await this.pupPage.evaluate(async inviteInfo => {
|
||||
let { groupId, fromId, inviteCode, inviteCodeExp, toId } = inviteInfo;
|
||||
return await window.Store.Wap.acceptGroupV4Invite(groupId, fromId, inviteCode, String(inviteCodeExp), toId);
|
||||
}, inviteInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current user's status message
|
||||
* @param {string} status New status message
|
||||
|
||||
Reference in New Issue
Block a user