Merge branch 'testeA'

pull/1/head
adriano 2022-02-15 07:42:58 -03:00
commit 22f3abf682
2 changed files with 20 additions and 20 deletions

View File

@ -37,7 +37,7 @@
"sequelize-cli": "^5.5.1",
"sequelize-typescript": "^1.1.0",
"socket.io": "^3.0.5",
"whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#multidevice",
"whatsapp-web.js": "^1.15.5",
"yup": "^0.32.8"
},
"devDependencies": {

View File

@ -37,28 +37,28 @@ const syncUnreadMessages = async (wbot: Session) => {
export const initWbot = async (whatsapp: Whatsapp): Promise<Session> => {
return new Promise((resolve, reject) => {
try {
// const io = getIO();
// const sessionName = whatsapp.name;
// let sessionCfg;
// if (whatsapp && whatsapp.session) {
// sessionCfg = JSON.parse(whatsapp.session);
// }
// const wbot: Session = new Client({session: sessionCfg,
// puppeteer: {executablePath: process.env.CHROME_BIN || undefined
// }
// });
const io = getIO();
const sessionName = whatsapp.name;
const SESSION_FILE_PATH = './session.json'
let sessionCfg
if(fs.existsSync(SESSION_FILE_PATH)){
sessionCfg = require(SESSION_FILE_PATH)
let sessionCfg;
if (whatsapp && whatsapp.session) {
sessionCfg = JSON.parse(whatsapp.session);
}
const wbot: Session = new Client({ puppeteer: { headless: true }, clientId: 'bd_'+whatsapp.id})
const wbot: Session = new Client({session: sessionCfg,
puppeteer: {executablePath: process.env.CHROME_BIN || undefined
}
});
// const io = getIO();
// const sessionName = whatsapp.name;
// const SESSION_FILE_PATH = './session.json'
// let sessionCfg
// if(fs.existsSync(SESSION_FILE_PATH)){
// sessionCfg = require(SESSION_FILE_PATH)
// }
// const wbot: Session = new Client({ puppeteer: { headless: true }, clientId: 'bd_'+whatsapp.id})
wbot.initialize();