mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2026-01-16 16:52:48 -06:00
Add blockUser functionality
This commit is contained in:
@@ -63,6 +63,7 @@ import { useMultiFileAuthStateDb } from '../../utils/use-multi-file-auth-state-d
|
||||
import { useMultiFileAuthStateRedisDb } from '../../utils/use-multi-file-auth-state-redis-db';
|
||||
import {
|
||||
ArchiveChatDto,
|
||||
BlockUserDto,
|
||||
DeleteMessage,
|
||||
getBase64FromMediaMessageDto,
|
||||
LastMessage,
|
||||
@@ -2796,6 +2797,18 @@ export class BaileysStartupService extends WAStartupService {
|
||||
}
|
||||
}
|
||||
|
||||
public async blockUser(data: BlockUserDto) {
|
||||
this.logger.verbose('Blocking user: ' + data.number);
|
||||
try {
|
||||
const jid = this.createJid(data.number);
|
||||
await this.client.updateBlockStatus(jid, data.status);
|
||||
|
||||
return { block: 'success' };
|
||||
} catch (error) {
|
||||
throw new InternalServerErrorException('Error blocking user', error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public async updateMessage(data: UpdateMessageDto) {
|
||||
try {
|
||||
const jid = this.createJid(data.number);
|
||||
|
||||
Reference in New Issue
Block a user