fix(whatsapp.gblib): SEND FILE and WPP providers.
This commit is contained in:
parent
d563c0f5ed
commit
c6de0f0fa1
1 changed files with 15 additions and 8 deletions
|
@ -138,7 +138,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
const gbaiName = `${this.min.botId}.gbai`;
|
const gbaiName = `${this.min.botId}.gbai`;
|
||||||
const localName = Path.join('work', gbaiName, 'profile');
|
const localName = Path.join('work', gbaiName, 'profile');
|
||||||
|
|
||||||
const createClient = (browserWSEndpoint) => {
|
const createClient = async (browserWSEndpoint) => {
|
||||||
let puppeteer: any = {
|
let puppeteer: any = {
|
||||||
headless: false, args: ['--disable-features=site-per-process',
|
headless: false, args: ['--disable-features=site-per-process',
|
||||||
`--user-data-dir=${localName}`]
|
`--user-data-dir=${localName}`]
|
||||||
|
@ -156,8 +156,8 @@ export class WhatsappDirectLine extends GBService {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
client.initialize();
|
await client.initialize();
|
||||||
this.browserWSEndpoint = client.browser.wsEndpoint();
|
this.browserWSEndpoint = client.pupBrowser.wsEndpoint();
|
||||||
|
|
||||||
client.on('message', (async message => {
|
client.on('message', (async message => {
|
||||||
await this.WhatsAppCallback(message, null);
|
await this.WhatsAppCallback(message, null);
|
||||||
|
@ -200,14 +200,21 @@ export class WhatsappDirectLine extends GBService {
|
||||||
GBLog.info(`WhatsApp QR Code authenticated for ${this.botId}.`);
|
GBLog.info(`WhatsApp QR Code authenticated for ${this.botId}.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
client.browser.on('disconnected', (async () => {
|
client.pupBrowser.on('disconnected', (async () => {
|
||||||
(createClient.bind(this))(this.browserWSEndpoint);
|
GBLog.info(`555555`);
|
||||||
|
await (createClient.bind(this))(null);
|
||||||
|
}).bind(this));
|
||||||
|
client.pupPage.on('error', (async () => {
|
||||||
|
GBLog.info(`22222s`);
|
||||||
|
if (!client.pupPage.isClosed()){
|
||||||
|
client.pupPage.close();
|
||||||
|
} await (createClient.bind(this))(null);
|
||||||
}).bind(this));
|
}).bind(this));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
(createClient.bind(this))(this.browserWSEndpoint);
|
await (createClient.bind(this))(this.browserWSEndpoint);
|
||||||
|
|
||||||
setUrl = false;
|
setUrl = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue