This commit is contained in:
2023-03-01 04:39:01 -06:00
parent 264bc5984f
commit 6f5885ff7d
2 changed files with 7 additions and 7 deletions

View File

@@ -83,7 +83,7 @@ const createClient = () => {
const isValidNumber = (rawNumber) => {
const regexGroup = /\@g.us\b/gm;
const exist = rawNumber.match(regexGroup);
console.log("IsValidWawebJS", rawNumber, exist, !exist)
// console.log("IsValidWawebJS", rawNumber, exist, !exist)
return !exist
}

View File

@@ -63,19 +63,19 @@ initBot = async () => {
let waReady = false
// Socket IO
io.on('connection', async function (socket) {
console.log("Conectando ...")
// console.log("Conectando ...")
socket.emit('ioStatus', socketioStatus);
socks = socket
await socket.emit('message', 'Conectando...');
socket.on('checkConn', async function () { // Si recibe mensaje, regresa "connOk"
console.log("checking conn")
// console.log("checking conn")
await socket.emit('connOk', 'Connected');
})
try {
client.on('message', msg => {
// console.log(msg)
console.log(waReady)
// console.log(waReady)
socketioStatus = "wa_msg"; socket.emit('ioStatus', socketioStatus); socket.emit('wa_msg', msg.body);
socket.emit('incomming', 'Message In')
waReady = true
@@ -145,7 +145,7 @@ initBot = async () => {
body('number').notEmpty(),
body('message').notEmpty(),
], async (req, res) => {
console.log("REQUEST=", req.body)
// console.log("REQUEST=", req.body)
socks.emit('incomming', 'Message In')
const errors = validationResult(req).formatWith(({
msg
@@ -181,7 +181,7 @@ initBot = async () => {
});
// Send buttons
app.post('/send-buttons', async (req, res) => {
console.log("REQUEST=", req.body)
// console.log("REQUEST=", req.body)
socks.emit('incomming', 'Button In')
if (client.theMsg === undefined) {
@@ -224,7 +224,7 @@ initBot = async () => {
});
// Send image
app.post('/send-image', async (req, res) => {
console.log("REQUEST=", req.body)
// console.log("REQUEST=", req.body)
socks.emit('incomming', 'Image In')
const number = phoneNumberFormatter(req.body.number);
// const filename = req.body.image || null;