feat(endpoint): add setPresence endpoint

This commit is contained in:
Diego Vieira
2024-03-19 00:58:45 +00:00
parent 5f5db2011e
commit e58f1d778e
6 changed files with 55 additions and 1 deletions

View File

@@ -72,6 +72,7 @@ import {
PrivacySettingDto,
ReadMessageDto,
SendPresenceDto,
SetPresenceDto,
UpdateMessageDto,
WhatsAppNumberDto,
} from '../dto/chat.dto';
@@ -1830,7 +1831,6 @@ export class BaileysStartupService extends WAStartupService {
}
// Instance Controller
public async sendPresence(data: SendPresenceDto) {
try {
const { number } = data;
@@ -1863,6 +1863,17 @@ export class BaileysStartupService extends WAStartupService {
}
}
// Presence Controller
public async setPresence(data: SetPresenceDto) {
try {
await this.client.sendPresenceUpdate(data.presence);
this.logger.verbose('Sending presence update: ' + data.presence);
} catch (error) {
this.logger.error(error);
throw new BadRequestException(error.toString());
}
}
// Send Message Controller
public async textMessage(data: SendTextDto, isChatwoot = false) {
this.logger.verbose('Sending text message');