mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2026-01-09 05:12:28 -06:00
feat(endpoint): add setPresence endpoint
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user