new(whatsapp.gblib): New WhatsApp provider: Meta.
This commit is contained in:
parent
bb6c202a1b
commit
645af9acd4
2 changed files with 13 additions and 9 deletions
|
@ -525,8 +525,6 @@ export class GBVMService extends GBService {
|
|||
const channel = this.channel;
|
||||
const ENTER = this.ENTER;
|
||||
const headers = this.headers;
|
||||
let data = this.data;
|
||||
let list = this.list;
|
||||
let httpUsername = this.httpUsername;
|
||||
let httpPs = this.httpPs;
|
||||
let today = this.today;
|
||||
|
@ -1107,8 +1105,6 @@ export class GBVMService extends GBService {
|
|||
sandbox['from'] = await dk.userMobile({ pid });
|
||||
sandbox['ENTER'] = String.fromCharCode(13);
|
||||
sandbox['headers'] = {};
|
||||
sandbox['data'] = {};
|
||||
sandbox['list'] = [];
|
||||
sandbox['httpUsername'] = '';
|
||||
sandbox['httpPs'] = '';
|
||||
sandbox['pid'] = pid;
|
||||
|
|
|
@ -648,9 +648,15 @@ export class GBConversationalService {
|
|||
});
|
||||
}
|
||||
|
||||
public async fillAndBroadcastTemplate(min: GBMinInstance, step: GBDialogStep, mobile: string, text) {
|
||||
public async fillAndBroadcastTemplate(min: GBMinInstance, mobile: string, text) {
|
||||
|
||||
let isMedia = text.toLowerCase().endsWith('.jpg') || text.toLowerCase().endsWith('.jpeg')
|
||||
|| text.toLowerCase().endsWith('.png');
|
||||
|
||||
let image = isMedia ?
|
||||
/(.*)\n/gmi.exec(text)[0].trim():
|
||||
text;
|
||||
|
||||
let image = /(.*)\n/gmi.exec(text)[0].trim();
|
||||
const gbaiName = DialogKeywords.getGBAIPath(min.botId);
|
||||
const fileUrl = urlJoin(process.env.BOT_URL,'kb', gbaiName, `${min.botId}.gbkb`, 'images', image);
|
||||
|
||||
|
@ -658,11 +664,13 @@ export class GBConversationalService {
|
|||
? image
|
||||
: fileUrl;
|
||||
|
||||
if (!isMedia){
|
||||
text = text.substring(image.length).trim();
|
||||
text = text.replace(/\n/g, "\\n");
|
||||
}
|
||||
|
||||
let data = {
|
||||
name: 'broadcast', components: [
|
||||
name: isMedia?'broadcast_notext':'broadcast', components: [
|
||||
{
|
||||
type: "header",
|
||||
parameters: [
|
||||
|
|
Loading…
Add table
Reference in a new issue