Remoção da versão beta MD(Multi Device) por problemas nas conexões
							parent
							
								
									4ccb5c5591
								
							
						
					
					
						commit
						0108de0ad3
					
				|  | @ -37,7 +37,7 @@ | ||||||
|     "sequelize-cli": "^5.5.1", |     "sequelize-cli": "^5.5.1", | ||||||
|     "sequelize-typescript": "^1.1.0", |     "sequelize-typescript": "^1.1.0", | ||||||
|     "socket.io": "^3.0.5", |     "socket.io": "^3.0.5", | ||||||
|     "whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#multidevice", |     "whatsapp-web.js": "^1.15.5", | ||||||
|     "yup": "^0.32.8" |     "yup": "^0.32.8" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|  |  | ||||||
|  | @ -37,28 +37,28 @@ const syncUnreadMessages = async (wbot: Session) => { | ||||||
| export const initWbot = async (whatsapp: Whatsapp): Promise<Session> => { | export const initWbot = async (whatsapp: Whatsapp): Promise<Session> => { | ||||||
|   return new Promise((resolve, reject) => { |   return new Promise((resolve, reject) => { | ||||||
|     try { |     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 io = getIO(); | ||||||
|       const sessionName = whatsapp.name; |       const sessionName = whatsapp.name; | ||||||
|       const SESSION_FILE_PATH = './session.json' |       let sessionCfg; | ||||||
|       let sessionCfg | 
 | ||||||
|       if(fs.existsSync(SESSION_FILE_PATH)){ |       if (whatsapp && whatsapp.session) { | ||||||
|         sessionCfg = require(SESSION_FILE_PATH) |         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(); |       wbot.initialize(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue