[+] Join groups by invite code

This commit is contained in:
Pedro Lopez
2020-02-02 00:52:51 -04:00
parent a6cc5e5bf2
commit caa8598ec1
3 changed files with 23 additions and 0 deletions

View File

@@ -175,6 +175,19 @@ class Client extends EventEmitter {
return ChatFactory.create(this, chat);
}
/**
* Accepts an invite by code
* @param {string} inviteCode
*/
async acceptInvite(inviteCode) {
const chat = await this.pupPage.evaluate(async inviteCode => {
const chatId = await Store.Invite.sendJoinGroupViaInvite(inviteCode);
return WWebJS.getChat(chatId._serialized);
}, inviteCode);
return ChatFactory.create(this.client, chat);
}
}
module.exports = Client;