improvement: stop deleting wbot session if phone is offline (timeout)

This commit is contained in:
canove
2020-10-24 22:54:24 -03:00
parent 63fdecd038
commit 443528d8ed
5 changed files with 107 additions and 100 deletions

View File

@@ -31,12 +31,13 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
isDefault
});
initWbot(whatsapp)
.then(() => {
wbotMessageListener(whatsapp);
wbotMonitor(whatsapp);
})
.catch(err => console.log(err));
try {
const wbot = await initWbot(whatsapp);
wbotMessageListener(wbot);
wbotMonitor(wbot, whatsapp);
} catch (err) {
console.log(err);
}
const io = getIO();
io.emit("whatsapp", {