Skip to content

Commit

Permalink
𝑾𝒊𝒍𝒎𝒆𝒓 𝒐𝒇𝒄
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilsmac authored Oct 27, 2024
1 parent d78c14f commit b785946
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ keys: makeCacheableSignalKeyStore(state.keys, Pino({ level: "fatal" }).child({ l
},
markOnlineOnConnect: true,
generateHighQualityLinkPreview: true,
syncFullHistory: true,
syncFullHistory: false,
getMessage: async (clave) => {
let jid = jidNormalizedUser(clave.remoteJid)
let msg = await store.loadMessage(jid, clave.id)
Expand All @@ -199,7 +199,7 @@ return msg?.message || ""
msgRetryCounterCache, // Resolver mensajes en espera
msgRetryCounterMap, // Determinar si se debe volver a intentar enviar un mensaje o no
defaultQueryTimeoutMs: undefined,
version: [2, 2513, 1],
version: [2, 3000, 1015901307],
}
global.conn = makeWASocket(connectionOptions)
if (!fs.existsSync(`./${authFile}/creds.json`)) {
Expand All @@ -213,7 +213,10 @@ addNumber = phoneNumber.replace(/[^0-9]/g, '')
do {
phoneNumber = await question(chalk.bgBlack(chalk.bold.greenBright(mid.phNumber2(chalk))))
phoneNumber = phoneNumber.replace(/\D/g,'')
} while (!Object.keys(PHONENUMBER_MCC).some(v => phoneNumber.startsWith(v)))
if (!phoneNumber.startsWith('+')) {
phoneNumber = `+${phoneNumber}`
}
} while (!await isValidPhoneNumber(phoneNumber))
rl.close()
addNumber = phoneNumber.replace(/\D/g, '')
setTimeout(async () => {
Expand Down Expand Up @@ -545,3 +548,18 @@ unwatchFile(file)
console.log(chalk.bold.greenBright(lenguajeCD['smsMainBot']().trim()))
import(`${file}?update=${Date.now()}`)
})

async function isValidPhoneNumber(number) {
try {
number = number.replace(/\s+/g, '')
// Si el número empieza con '+521' o '+52 1', quitar el '1'
if (number.startsWith('+521')) {
number = number.replace('+521', '+52'); // Cambiar +521 a +52
} else if (number.startsWith('+52') && number[4] === '1') {
number = number.replace('+52 1', '+52'); // Cambiar +52 1 a +52
}
const parsedNumber = phoneUtil.parseAndKeepRawInput(number)
return phoneUtil.isValidNumber(parsedNumber)
} catch (error) {
return false
}}

0 comments on commit b785946

Please sign in to comment.