mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-14 01:41:24 -06:00
feat: accept invite code
This commit is contained in:
parent
ea9ba27f22
commit
5759341c52
@ -9,6 +9,7 @@
|
|||||||
* Route to update the privacy settings
|
* Route to update the privacy settings
|
||||||
* Route to update group subject
|
* Route to update group subject
|
||||||
* Route to update group description
|
* Route to update group description
|
||||||
|
* Route to accept invite code
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -56,6 +56,12 @@ export class GroupController {
|
|||||||
return await this.waMonitor.waInstances[instance.instanceName].inviteInfo(inviteCode);
|
return await this.waMonitor.waInstances[instance.instanceName].inviteInfo(inviteCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async acceptInvite(instance: InstanceDto, inviteCode: GroupInvite) {
|
||||||
|
return await this.waMonitor.waInstances[instance.instanceName].acceptInvite(
|
||||||
|
inviteCode,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public async revokeInviteCode(instance: InstanceDto, groupJid: GroupJid) {
|
public async revokeInviteCode(instance: InstanceDto, groupJid: GroupJid) {
|
||||||
return await this.waMonitor.waInstances[instance.instanceName].revokeInviteCode(
|
return await this.waMonitor.waInstances[instance.instanceName].revokeInviteCode(
|
||||||
groupJid,
|
groupJid,
|
||||||
|
@ -120,6 +120,16 @@ export class GroupRouter extends RouterBroker {
|
|||||||
|
|
||||||
res.status(HttpStatus.OK).json(response);
|
res.status(HttpStatus.OK).json(response);
|
||||||
})
|
})
|
||||||
|
.get(this.routerPath('acceptInvite'), ...guards, async (req, res) => {
|
||||||
|
const response = await this.inviteCodeValidate<GroupInvite>({
|
||||||
|
request: req,
|
||||||
|
schema: groupInviteSchema,
|
||||||
|
ClassRef: GroupInvite,
|
||||||
|
execute: (instance, data) => groupController.acceptInvite(instance, data),
|
||||||
|
});
|
||||||
|
|
||||||
|
res.status(HttpStatus.OK).json(response);
|
||||||
|
})
|
||||||
.put(this.routerPath('revokeInviteCode'), ...guards, async (req, res) => {
|
.put(this.routerPath('revokeInviteCode'), ...guards, async (req, res) => {
|
||||||
const response = await this.groupValidate<GroupJid>({
|
const response = await this.groupValidate<GroupJid>({
|
||||||
request: req,
|
request: req,
|
||||||
|
@ -1702,6 +1702,14 @@ export class WAStartupService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async acceptInvite(id: GroupInvite) {
|
||||||
|
try {
|
||||||
|
return await this.client.groupAcceptInvite(id.inviteCode);
|
||||||
|
} catch (error) {
|
||||||
|
throw new NotFoundException('No invite info', id.inviteCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async revokeInviteCode(id: GroupJid) {
|
public async revokeInviteCode(id: GroupJid) {
|
||||||
try {
|
try {
|
||||||
const inviteCode = await this.client.groupRevokeInvite(id.groupJid);
|
const inviteCode = await this.client.groupRevokeInvite(id.groupJid);
|
||||||
|
Loading…
Reference in New Issue
Block a user