new(whatsapp.gblib): New WhatsApp provider: Meta.

This commit is contained in:
Rodrigo Rodriguez 2024-05-06 17:52:08 -03:00
parent a8099c5f97
commit 6130f01565
2 changed files with 14 additions and 1 deletions

View file

@ -612,6 +612,19 @@ export class DialogKeywords {
return await this.internalSendFile({ pid, mobile, channel: proc.channel, filename, caption });
}
/**
* Sends a template to a given mobile.
*
* @example SEND TEMPLATE TO "+199988887777","image.jpg"
*
*/
public async sendTemplateTo({ pid, mobile, filename: text}) {
const { min, user, proc } = await DialogKeywords.getProcessInfo(pid);
GBLogEx.info(min, `BASIC: SEND TEMPLATE TO '${mobile}',filename '${text}'.`);
const service = new GBConversationalService(min.core);
return await service.fillAndBroadcastTemplate(min, mobile, text);
}
/**
* Sends a file to the current user.
*

View file

@ -1028,7 +1028,7 @@ export class KeywordsExpressions {
/^\s*(send template to)(\s*)(.*)/gim,
($0, $1, $2, $3) => {
const params = this.getParams($3, ['mobile', 'text']);
return `await dk.fillAndBroadcastTemplate({pid: pid, ${params}})`;
return `await dk.sendTemplateTo({pid: pid, ${params}})`;
}
];