mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-22 20:12:02 -06:00
fix: Improvement for Validation of Numbers and Groups
This commit is contained in:
commit
854c7ed04d
@ -1486,14 +1486,14 @@ export class WAStartupService {
|
||||
}
|
||||
|
||||
number = number
|
||||
?.split(':')[0]
|
||||
?.split('@')[0]
|
||||
?.replace(' ', '')
|
||||
?.replace('+', '')
|
||||
?.replace('(', '')
|
||||
?.replace(')', '');
|
||||
?.replace(/\s/g, '')
|
||||
.replace(/\+/g, '')
|
||||
.replace(/\(/g, '')
|
||||
.replace(/\)/g, '')
|
||||
.split(/\:/)[0]
|
||||
.split('@')[0];
|
||||
|
||||
if (number.includes('-') && number.length >= 18) {
|
||||
if (number.includes('-') && number.length >= 24) {
|
||||
this.logger.verbose('Jid created is group: ' + `${number}@g.us`);
|
||||
number = number.replace(/[^\d-]/g, '');
|
||||
return `${number}@g.us`;
|
||||
@ -2332,7 +2332,7 @@ export class WAStartupService {
|
||||
|
||||
const onWhatsapp: OnWhatsAppDto[] = [];
|
||||
for await (const number of data.numbers) {
|
||||
const jid = this.createJid(number);
|
||||
let jid = this.createJid(number);
|
||||
|
||||
if (isJidGroup(jid)) {
|
||||
const group = await this.findGroup({ groupJid: jid }, 'inner');
|
||||
@ -2341,6 +2341,7 @@ export class WAStartupService {
|
||||
|
||||
onWhatsapp.push(new OnWhatsAppDto(group.id, !!group?.id, group?.subject));
|
||||
} else {
|
||||
jid = !jid.startsWith('+') ? `+${jid}` : jid;
|
||||
const verify = await this.client.onWhatsApp(jid);
|
||||
|
||||
const result = verify[0];
|
||||
|
Loading…
Reference in New Issue
Block a user