new(whatsapp.gblib): New WhatsApp provider: Meta.
This commit is contained in:
parent
6130f01565
commit
d07feba899
2 changed files with 14 additions and 3 deletions
|
@ -618,11 +618,22 @@ export class DialogKeywords {
|
|||
* @example SEND TEMPLATE TO "+199988887777","image.jpg"
|
||||
*
|
||||
*/
|
||||
public async sendTemplateTo({ pid, mobile, filename: text}) {
|
||||
public async sendTemplateTo({ pid, mobile, filename}) {
|
||||
const { min, user, proc } = await DialogKeywords.getProcessInfo(pid);
|
||||
GBLogEx.info(min, `BASIC: SEND TEMPLATE TO '${mobile}',filename '${text}'.`);
|
||||
GBLogEx.info(min, `BASIC: SEND TEMPLATE TO '${mobile}',filename '${filename}'.`);
|
||||
const service = new GBConversationalService(min.core);
|
||||
|
||||
let text;
|
||||
if (filename.endsWith('.docx')) {
|
||||
text = await min.kbService.getAnswerTextByMediaName(min.instance.instanceId, filename);
|
||||
}
|
||||
else{
|
||||
text = filename;
|
||||
}
|
||||
|
||||
|
||||
return await service.fillAndBroadcastTemplate(min, mobile, text);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1027,7 +1027,7 @@ export class KeywordsExpressions {
|
|||
keywords[i++] = [
|
||||
/^\s*(send template to)(\s*)(.*)/gim,
|
||||
($0, $1, $2, $3) => {
|
||||
const params = this.getParams($3, ['mobile', 'text']);
|
||||
const params = this.getParams($3, ['mobile', 'filename']);
|
||||
return `await dk.sendTemplateTo({pid: pid, ${params}})`;
|
||||
}
|
||||
];
|
||||
|
|
Loading…
Add table
Reference in a new issue