improv: ajustado a validação aceitar todos os emojis.

This commit is contained in:
ricael
2025-07-17 09:17:06 -03:00
parent 39606240da
commit 71ebecbed3
3 changed files with 21 additions and 6 deletions

View File

@@ -17,13 +17,13 @@ import {
import { WAMonitoringService } from '@api/services/monitor.service';
import { BadRequestException } from '@exceptions';
import { isBase64, isURL } from 'class-validator';
import emojiRegex from 'emoji-regex';
function isEmoji(str: string) {
if (str === '') return true;
const emojiRegex =
/^[\u{1F300}-\u{1F9FF}\u{2600}-\u{26FF}\u{2700}-\u{27BF}\u{1F000}-\u{1F02F}\u{1F0A0}-\u{1F0FF}\u{1F100}-\u{1F64F}\u{1F680}-\u{1F6FF}]$/u;
return emojiRegex.test(str);
const match = str.match(emojiRegex());
return match?.length === 1 && match[0] === str;
}
export class SendMessageController {