Join in Group by Invite Code

This commit is contained in:
Leandro Rocha
2024-01-21 02:13:24 -03:00
parent 69a323691f
commit e19e37eef4
6 changed files with 50 additions and 1 deletions

View File

@@ -89,6 +89,7 @@ import {
WhatsAppNumberDto,
} from '../dto/chat.dto';
import {
AcceptGroupInvite,
CreateGroupDto,
GetParticipant,
GroupDescriptionDto,
@@ -3744,6 +3745,16 @@ export class WAStartupService {
}
}
public async acceptInviteCode(id: AcceptGroupInvite) {
this.logger.verbose('Joining the group by invitation code: ' + id.inviteCode);
try {
const groupJid = await this.client.groupAcceptInvite(id.inviteCode);
return { accepted: true, groupJid: groupJid };
} catch (error) {
throw new NotFoundException('Accept invite error', error.toString());
}
}
public async revokeInviteCode(id: GroupJid) {
this.logger.verbose('Revoking invite code for group: ' + id.groupJid);
try {